View Full Version : a function to create a mask.
Hi,
I want to use a function that is likely to create a mask. I can do this manually, like this :
src=AVISource("...")
ALL=crop(0,0,0,0)
mask=src.mt_lutspa(relative = false, expr = "y 108.2 < y 480 < y 374.5 > & | 0 255 ?").greyscale
a=mt_merge(ALL, src, mask, luma = true)
Like this I can process or keep untouched the portion set via expr. Do you know an automated avisynth function or a function that would easely enable me to create a mask i.e a portion defined by its coordinates like below kept untouched and/or that I want to be processed differently from the rest ?
cretindesalpes
7th July 2012, 11:22
If you just want to process only a rectangle area, check quadratura (http://www.animemusicvideos.org/forum/viewtopic.php?f=44&t=107160#p1424215).
Thanks. Could you give an example of use then ? Moreover, would you know another filter to process a circular area or a any other interesting shape ?
poisondeathray
7th July 2012, 20:03
Probably be faster and easier to create the "interesting shape" mask in your image program (gimp, photoshop etc...)
I'm not totally understanding you. How could I mix into my avisynth script below a given shape created with an image program ? Again it would be nice to have an example.
cretindesalpes
8th July 2012, 10:11
For quadratura:
flt = Blur (1)
quadratura (flt, 50, 50, 100, 100)
For the shape as image:
flt = Blur (1)
mask = ImageSource ("mask.png", end=FrameCount()-1).ConvertToYV12 ()
mt_merge (src, flt, mask, luma=true)
Yes cretindesalpes (in passing, funny nickaname) ;
quadratura : then the blur will only be applied on the 50 50 100 100 section, won't it ?
for the mask : well in fact it is not what I would like to do. Imagine I have a video with different frames in the same picture and which are not static, like that for example http://i4.ytimg.com/vi/c1DJQi2c67s/mqdefault.jpg. Below I used this : mask=src.mt_lutspa(relative = false, expr = "y 108.2 < y 480 < y 374.5 > & | 0 255 ?"
Likewise I can process only two zones ; I was wondering if there was an automated filter to achieve something like this ; I guess quadratura is what I'm looking for..
sirt
18th January 2013, 10:24
I'm sorry to come back to this thread again but cretindesalpes suggested a code above to use a personnal shape as a mask (mask.png) but how am I supposed to create such a shape ? Let's say I want to make a heart for example ; can you create such a shape via Photoshop or any similar program ? Imagine I would like to process a 1000x1000 frame and that I use the heart, its dimensions being 300x300 for example, and I want to process ALL the part covered by the heart but anything out of it. I will use this code then :
flt = Blur (1)
mask = ImageSource ("mask.png", end=FrameCount()-1).ConvertToYV12 ()
mt_merge (src, flt, mask, luma=true)
Then everyhting INSIDE the shape will be blurred. But the question is the one I mentionned before : how to create a "mask" ? I know I could draw something on Gimp or something like that but I don't know if that would be a mask. Well I know it's confusing...
cretindesalpes
18th January 2013, 10:40
Yes, draw the shape in Gimp or a similar program. All white for the processed parts, and all black for the masked parts.
sirt
18th January 2013, 22:19
Ok, in fact it is simple, thank you.
Then do you think there is a possibility to create a mask in order to process only luma or chroma while denoising with a denoiser ? This is in echo to my "Luma Chroma Denoise" post. I know such a question is somewhat hazy but, as far as I know, such a mask would consist in only selecting some kind of frequencies.
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.