Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion. Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules. |
|
|
Thread Tools | Search this Thread | Display Modes |
|
4th February 2011, 20:56 | #1 | Link |
Registered User
Join Date: Apr 2007
Posts: 240
|
Question about using "summing" masks (for ColorKeyMask use)
I'm selecting a movie's credits with ColorKeyMask in a certain frame range. Like this:
lettersmask=ApplyRange(9914, 10017, "ColorKeyMask", $F1791A, 12) How can I sum ALL the pixels collected through the range and have it as one mask? The credits are put on a non-constant, live action background, so I have to use a quite low threshold to not select false pixels everywhere on the picture. So the selection is not full on any of the frames, and slightly differs on every frame. But summing up them would result in a near perfect mask. How can I do that? (It'd be even better if I could spread that perfect mask onto the mask clip's (lettersmask) range afterwards, but that's not vital.) Thanks in advance. |
4th February 2011, 21:20 | #2 | Link |
Registered User
Join Date: Apr 2002
Location: Germany
Posts: 5,391
|
ScriptClip, FrameEvaluate et al, and sum the masks up with e.g. mt_logic("max").
__________________
- We´re at the beginning of the end of mankind´s childhood - My little flickr gallery. (Yes indeed, I do have hobbies other than digital video!) |
4th February 2011, 23:12 | #3 | Link | |
Avisynth language lover
Join Date: Dec 2007
Location: Spain
Posts: 3,431
|
You don't need to use mt_logic, since repeated applications of ColorKeyMask act to sum the mask anyway.
(Also ColorKeymask is an RGB32 filter while mt_logic works on YUV.) You can use ScriptClip like this: Code:
... Trim(9914, 10017) m = ResetMask().ShowAlpha() ScriptClip(""" m = Mask(m.SelectEvery(1,-1)).ColorKeyMask($F1791A, 12).ShowAlpha() return m """) An alternative is to use GScript to loop explicitly over the required frames. This has the advantage that you can go on to use the resulting mask in the same script - as you said: Quote:
Code:
... m = ResetMask().ShowAlpha().Trim(0,-1) # 1-frame opaque mask GScript(""" for (frame=9914, 10017) { m = Trim(frame, -1).Mask(m).ColorKeyMask($F1791A, 12).ShowAlpha() } """) ApplyRange(9914, 10017, "Mask", m.Loop(10017-9914+1)) Last edited by Gavino; 5th February 2011 at 16:56. Reason: Added missing calls to ShowAlpha() |
|
|
|