Log in

View Full Version : masks and colours - help needed


2Bdecided
19th October 2007, 17:33
I want to create a mask that represents the difference between two clips (x and y), and then uses that mask to replace the different parts with another clip (z), e.g.

diff=mt_lutxy(x.converttoYV12(),y.ConvertToYV12(),"x y - abs")

diff=diff.Levels(5,1,40,0,255)

mt_merge(y.converttoYV12(),z.ConvertToYV12(),diff,U=3,V=3)

The problem is this: I want to pick up all differences - luma and chroma - and then I want to combine all three into a single plane, and then use that single plane as the mask for all three planes.

So, for example, even if in some part of some frame there's only a difference in U or V, I want the mask to let me replace that part's Y, U and V.


I think I just need some appropriate colour plane merging, but I don't know how to do it.

Can anyone help please?

Cheers,
David.

Didée
19th October 2007, 17:57
Compairing & combing all three planes, like you said.
Some changes to your script, for making a mask that contains the maximum diff from the three diff's on Y,U,V:

diff = mt_LutXY(x.ConvertToYV12(), y.ConvertToYV12(), "x y - abs", U=3,V=3)

diff = diff.mt_Logic(diff.UtoY().LanczosResize(width(x),height(x)), "max")
\ .mt_Logic(diff.VtoY().LanczosResize(width(x),height(x)), "max")

diff = diff.Levels(5,1,40,0,255)

mt_Merge(y.ConvertToYV12(), z.ConvertToYV12(), diff, luma=true, U=3,V=3)

2Bdecided
19th October 2007, 20:35
Brilliant, thank you Didée - that's exactly what I need.

Cheers,
David.