View Single Post
Old 20th December 2005, 15:36   #1  |  Link
actionman133
Movie buff & shine
 
Join Date: Jan 2004
Location: Logan, the only hole above ground.
Posts: 257
A new attempt at good deblending

Hi,

Of course no one would remember that a long time ago, I attempted to create a deblend function for correcting films that underwent telecine and then had the fields blurred together.

I wasn't very successful then, but just tonight I'm trying a slightly different approach but I am stuck on how to use FrameEvaluate... the help guide might as well be inverted chinese algebra, because it makes me go crosseyed (rest of the guide is good, though).

Here is the test script to set up the detection process.

Code:
Function DeBlend (clip Last) {

a = Subtract (Last, Trim (1, 0).Levels (0, 1, 255, 128, 255, False)).Levels (0, 1, 127, 0, 255, False).Trim (1, 0)
b = Subtract (Levels (0, 1, 255, 0, 127, False), Trim (1, 0)).Levels (0, 1, 127, 255, 0, False).DuplicateFrame (0)

StackVertical (Last, a, b)

}
The result of this test is the original clip displayed on top, with two deblended frames beneath them. Those two deblended frames should be identical when the first blended frame in the pattern appears in the original clip.

That's worked fine for me so far. Where FrameEvaluate () comes in and messes me up is how to have the function work out whether to deblend or not. Here is the script I more or less came up with (I know the syntax is WAAAY out)...

Code:
Function DeBlend (clip Last) {

# Perform Deblends for the comparison test
a = Subtract (Last, Trim (1, 0).Levels (0, 1, 255, 128, 255, False)).Levels (0, 1, 127, 0, 255, False).Trim (1, 0)
b = Subtract (Levels (0, 1, 255, 0, 127, False), Trim (1, 0)).Levels (0, 1, 127, 255, 0, False).DuplicateFrame (0)

# Get difference between two tests
Global Test = Subtract (a, b)

# Get difference for each pair of frames in a 5 frame set
ab = FrameEvaluate ("YPlaneMinMaxDifference (Test.SelectEvery (5, 0))")
bc = FrameEvaluate ("YPlaneMinMaxDifference (Test.SelectEvery (5, 1))")
cd = FrameEvaluate ("YPlaneMinMaxDifference (Test.SelectEvery (5, 2))")
de = FrameEvaluate ("YPlaneMinMaxDifference (Test.SelectEvery (5, 3))")
ea = FrameEvaluate ("YPlaneMinMaxDifference (Test.SelectEvery (5, 4))")

# Find the frame which had the lowest difference in the two tests
Dupe = (ab > bc) ? "bc" : "ab"
Dupe = (Eval (Dupe) > cd) ? "cd" : Dupe
Dupe = (Eval (Dupe) > de) ? "de" : Dupe
Dupe = (Eval (Dupe) > ea) ? "ea" : Dupe

# Use SelectEvery to delete Dupe... not yet implemented

}
The FrameEvaluate () section is supposed to calculate the difference between the two deblend tests (a & b). The Dupe variable tests to find out which of these frames produced the smallest difference in those tests. The SelectEvery () piece will then remove the blended frames and replace them with a single deblended frame.

Now, for those who made it this far.... ... how do I properly implement FrameEvaluate () to retrieve the comparitive differences between a and b?

Thanks.
__________________
I'm a boxer who can Bob () & Weave (). I like to Overlay () punches and Blur () his vision to ShowFiveVersions (). My KO punch will always Pulldown ().TimeStretch () and all he will hear is Tone ().
actionman133 is offline   Reply With Quote