Log in

View Full Version : mmask


Terka
30th July 2009, 15:34
want to apply some filtering, let say blur on moving areas only. using MMask
the vector search is provided on filtered script (calmi() function).
how to finish the overlay- the mask i got is green?


source=avisource("c:\hj\kamera\avisynth\psi\!Psi.avi").bob(0,0.5).calmi()

super = source.MSuper(pel=2, sharp=1)

backward_vec2 = super.MAnalyse(isb = true, delta = 2, overlap=4)
backward_vec1 = super.MAnalyse(isb = true, delta = 1, overlap=4)
forward_vec1 = super.MAnalyse(isb = false, delta = 1, overlap=4)
forward_vec2 = super.MAnalyse(isb = false, delta = 2, overlap=4)

degrained = source.MDegrain2(super, backward_vec1, forward_vec1, backward_vec2, forward_vec2, thSAD=400)

vectors = degrained.MSuper().MAnalyse(isb = false)
return degrained.MMask(vectors,ml=100)

function calmI (clip)
{
t1 = clip.temporalsoften(1,255,255,28,2)
t2 = clip.temporalsoften(2,255,255,28,2)
t1.merge(t2,0.357).merge(clip,0.125)
return(last)
}

Fizick
30th July 2009, 17:30
do not understand where are your original and blured clips.

Overlay (original, blured, mask=filtered.MMask(vectors))

Didée
30th July 2009, 17:54
It's perfectly normal that the mask apears in some colors. Just proceed, and merge with Overlay() or mt_merge(). It's okay.

Keep in mind that the meaning of values in U/V channels is totally different for "masks" compared to "regular image content". For regular content, U/V channels have their "zero point" at 128 (saturation=0), and two "signed" maxima at 0 and 255 respectively (saturation=100%). When it's a mask, then the meaning of values is simply: "zero" at 0, and maximum at 255. However: when you *display* such a mask, then the UV values are still interpreted as color values. That's what you see.


In case of doubt, use (for YV12 colorspace only)

c = last
stackhorizontal( c.greyscale().subtitle("luma"),
\ stackvertical( c.UtoY().subtitle("chroma - U"),
\ c.VtoY().subtitle("chroma - V") ) )

or (for YV12 or YUY2)
c = last
stackvertical( c.greyscale().subtitle("luma"),
\ stackhorizontal( c.UtoY().subtitle("chroma - U"),
\ c.VtoY().subtitle("chroma - V") ) )

or (for YUY2 only)
c = last
stackhorizontal( c.greyscale().subtitle("luma"),
\ c.UtoY().subtitle("chroma - U"),
\ c.VtoY().subtitle("chroma - V") )
to see easily what actually is in the various channels.