Log in

View Full Version : YDifferenceFromPrevious, AverageLuma ?


lisztfr9
26th November 2012, 12:35
Hi,

"YUV is a color model - or color space - that consists of one luma (a.k.a. brightness) component, Y" (wiki)

Code :

WriteFile(filename, "current_frame", "colon", "YDifferenceFromPrevious", "colon", "AverageLuma", flush=true)


Output :


0: 0.000000: 91.990440
1: 7.229414: 90.837395
2: 6.917845: 91.439629
3: 5.629769: 91.108070
4: 6.149966: 91.371422
5: 6.249398: 90.300537
6: 5.568695: 91.179222
7: 6.245852: 89.969498
8: 6.368322: 90.976563
9: 5.497233: 90.415611


The average luma difference between frame 1 and 2 :

91.439629 - 90.837395 = 0.599534

YDifferenceFromPrevious = 6.917845

So what is the real relationship between YDiff and luma, or the computation made here ?

I know Ydifference computes the total difference between two frames by pixels, but how ? then even 6.917845 is too low.

I need to select frames while they have more luma than previous and next, but since Ydiff returns absolute (not signed) values i can't use it, i tried yesterday but i didn't succeed. I need to access average luma of previous and next frame, imho.

That's a lot of questions :)
Thanks, L

Gavino
26th November 2012, 14:39
So what is the real relationship between YDiff and luma, or the computation made here ?
YDiff is not the difference between the average luma of the two frames. Instead, it is the average absolute luma difference between pixels at the same location - for each pixel position, the absolute luma difference is calculated, the results are summed and divided by the total number of pixels to find the average.

I need to select frames while they have more luma than previous and next, but since Ydiff returns absolute (not signed) values i can't use it, i tried yesterday but i didn't succeed. I need to access average luma of previous and next frame, imho.
That's right.
Note that using GRunT, you can get these easily with AverageLuma(-1) and AverageLuma(1). ;)

Chikuzen
26th November 2012, 14:45
http://avisynth.org/warpenterprises/files/planeminmax_25_dll_20050727.zip

lisztfr9
27th November 2012, 11:39
Thanks to all, Gavino ok i understand it better now, and Chikuzen, it seems a bit similar to native YPlane function.

Edit : i think i could have use also R-Stat for accessing other frames, but Grunt is much easier.. :)

StainlessS
27th November 2012, 16:52
Edit : i think i could have use also R-Stat for accessing other frames, but Grunt is much easier.. :)

Not really sure how AverageLuma(-1) is much easier than RT_AverageLuma(-1), but it is faster if on full frame only
(maybe its the extra typing involved ie "RT_").