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. |
11th July 2017, 05:03 | #1 | Link |
Registered User
Join Date: Dec 2005
Posts: 110
|
Average n of x (TooT style)
The goal: average VHS/etc captures. To get rid of semi random errors caused by analog crappiness.
I've tried: Code:
video = core.misc.AverageFrames([video1, video2, video3, video4, video5], [1,1,1,1,1]) It's decent. But 2/3 ("TooT for Avisynth") or 3/5 or some other weight would be better. No idea how to do it tho. |
11th July 2017, 06:42 | #2 | Link |
Registered User
Join Date: Jan 2016
Posts: 162
|
I guess the "TooT or Avisynth" works the same way as the following code according to E-Male's thread:
Code:
def toot(clipa, clipb, clipc): absXYMinus = 'x y - abs' absXZMinus = 'x z - abs' absYZMinus = 'y z - abs' xyAverage = 'x y + 2 /' xzAverage = 'x z + 2 /' yzAverage = 'y z + 2 /' expr = '{0} {1} < {0} {2} < {3} {5} ? {1} {2} < {4} {5} ? ?'.format(absXYMinus, absXZMinus, absYZMinus, xyAverage, xzAverage, yzAverage) return core.std.Expr([clipa, clipb, clipc], [expr]) Last edited by WolframRhodium; 11th July 2017 at 12:46. |
11th July 2017, 11:43 | #3 | Link | |
Professional Code Monkey
Join Date: Jun 2003
Location: Kinnarps Chair
Posts: 2,548
|
Quote:
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet |
|
11th July 2017, 12:37 | #4 | Link | |
Registered User
Join Date: Jan 2016
Posts: 162
|
Quote:
e.g: Code:
diff = MakeDiff(a, b) a_ = MergeDiff(b, diff) If a=1, b=254, then diff=0 due to the clipping, so a_=126, not equal to a. One way I know to solve that is the following: Code:
diff = MakeDiff(a, b) b_tmp = MakeDiff(a, diff) a_ = MergeDiff(b_tmp, diff) As for TooT, overflow can affect the decision of which two clips should be averaged, so I do not use MakeDiff. But sure, there's no problem with Merge, so the code can be: Code:
def toot(clipa, clipb, clipc): absXYMinus = 'x y - abs' absXZMinus = 'x z - abs' absYZMinus = 'y z - abs' xyAvg = core.std.Merge(clipa, clipb) xzAvg = core.std.Merge(clipa, clipc) yzAvg = core.std.Merge(clipb, clipc) expr = '{0} {1} < {0} {2} < a c ? {1} {2} < b c ? ?'.format(absXYMinus, absXZMinus, absYZMinus) return core.std.Expr([clipa, clipb, clipc, xyAvg, xzAvg, yzAvg], [expr]) Last edited by WolframRhodium; 11th July 2017 at 12:46. |
|
11th July 2017, 14:44 | #6 | Link | |
Registered User
Join Date: Jan 2016
Posts: 162
|
Quote:
The code will be very long for 3 of 5 when using ternary operator to implement argmin as above. Even for 2 of 5, 2^4=16 operators are required, I think. I'm too lazy to do it, (and I usually make mistakes on such large programs). Last edited by WolframRhodium; 11th July 2017 at 14:47. |
|
Thread Tools | Search this Thread |
Display Modes | |
|
|