Log in

View Full Version : questions on Avisynth masks and frame structure


greymouse
30th August 2007, 21:37
morning:)

i was wondering if anyone could provide a link for newbie help in regards to using masks with avisynth,

i would like to know if masks work similar to masks in a paint program allowing you select an area of frame which you can then apply filters too.. :)

finally can someone post a link in regards to a frames structure, what makes up a frame (i know about color space already etc).. is a frame stored like a picture is? i mean a picture would have header information plus pixel information on regards to color...

hope that makes sense?

thanks in advanced!
:thanks:

J_Darnley
31st August 2007, 11:03
I'm no expert but in AviSynth a mask is just a clip of arbitrary length and size in any colour space that you want to use as a mask. It is not really the same as in image editors as they often have a mask for evey layer. If you want to learn how to use masks read the documentation (http://avisynth.org/mediawiki/Internal_filters) for the filter in question as not all filters can use a mask clip. In fact the only one I know is the Overlay filter of AviSynth.

As for frames, when they are in memory, I would assume that they are just stored as the pixel values for each channel. Now this is where the planar and interleaved format come in. YV12 stores it's three channels seperately, Y (luma), U and V (colour) planes. As far as I know all the other colour formats that AviSynth supports uses an interleaved format. In the case of RGB is that it stores the red, green and blue values of a pixel together. The AviSynth wiki has a few links to other articles on its YV12 FAQ http://avisynth.org/mediawiki/YV12_FAQ

When it is written to disk it depends entirely on what format you use. If you write the raw data to disk, then it will be just that, the raw pixel data with no dimensions or colour space information. Other formats may include headers and of course compressed video is a whole lot more complicated.

greymouse
6th September 2007, 21:38
hey mate thanks for your reply!

im intregied about the idea of applying color alterations to a masked area or part of the frame as opposed to the whole frame..

i have some footage which has got some red saturation throughout the frame which i want to keep, but the speakers hands are the problem everytime he moves his hands they are over saturated with red.. i have tried using tweakcolor to change the saturation of the red but because it targets the whole frame it loses to much detail..

so im using an overlay bitmap which has the hands area covered in a filled white box and the rest of the frame (720x576) is covered in black for use with the overlay()

it seems to work well but im abit stuck on to how to target just the inside of the white box... i see the white box and the rest of the frame is okay because the black just blends in with the background..

i can't quite grasp the way masking works i understand you can target outlines with masks? or the whole frame? is there a way to target the white area only?

any ideas?

thanks!
:thanks:

J_Darnley
6th September 2007, 23:25
You need to use the black and white clip as the mask and not the overlay. Try using:
Overlay(original_clip, corrected clip, mask=mask_clip)

greymouse
13th September 2007, 21:20
yep i got it working thanks for your help!

this is turning out to be too cool! :devil:

:thanks: