PDA

View Full Version : Fast condition to detect a blank frame?


fray
6th January 2006, 15:25
Hi,

I've got this problem to solve

I've got a directory full of frames I fixed manually in JPG format.
And I read them all into a clip using
fixframeclip = ImageSource("<path>\fix%05d.jpg", 0, 26703, 25)

Now fixframeclip has all corrected frames and many black ones.
All black frames seem to have an AverageLuma() of 16.

Fixing would work like this:
ConditionalFilter(finalclip, original, fixframeclip , "AverageLuma()", "equals", "16")

But this is very slow. Is there a faster way to identify black frames that
also works with very dark frames in fixframeclip?

Mug Funky
7th January 2006, 04:55
i'm surprised it's that slow actually. i do a similar thing with a framedrop filling script (check ydifferencefromprevious() is below a very very low threshold) and the speed wasn't awfully slow. it's slower than playing back of course...

one thing you can do is reduceby2() your metric clips a couple of times, but that may take more time to resample than it does to take an average of the large frame.

Didée
7th January 2006, 06:06
It would've been clever to spend some more thoughts on the later work, before doing all the fixing work ...

Then, what means

>> All black frames seem to have an AverageLuma() of 16

Is that not even sure, or what?

What eventually could work is
YV12Lutxy(original,fixframeclip.fity2uv(),"y 16 = x y ?","y 16 = x y ?","y 16 = x y ?",U=3,V=3) but this might go off in those places where "non-black" frames of 'fixframeclip' contain pixels with Y=16.

fray
8th January 2006, 22:32
>> All black frames seem to have an AverageLuma() of 16

Is that not even sure, or what?

Ok, they all are 16 (I was a bit confused by this, as I way expecting a zero value).

What eventually could work is YV12Lutxy...

This works in spotting the frames. As a result I get a
clip that's green for dark grey values and purple for whites.
Only 100% black stays black.

I then tried it without the ".fity2uv()" (having no idea what it
does) and luckily that works for me. My sources are in b&w
so I don't know if this will do in color as well.

YV12Lutxy(original,fixframeclip,"y 16 = x y ?","y 16 = x y ?","y 16 = x y ?",U=3,V=3)

Thanks for the suggestion.