Log in

View Full Version : Detecting Luma complexitivity in given Frames?


Inc
12th August 2004, 18:46
Hi,

I looked for this in here but nothing found for my needing, so I do ask now ...


I do know that there does exist a conditional filtering routine which does base on YdifferenceToNext...

clip = ImportingSource("XXXXXXXXXXX.xxx")

ScriptClip(clip, "diff = YDifferenceToNext?()"+chr(13)+"diff > 2.5 ? Filter(amount=diff) : FilterTwo(amount=diff)")

But that one dos only inspect the diff of luma change as a whole to the followed frame. Also AverageLuma() inspects the whole present frame.

What I need is a routine like -LumaComplexityToNext()-, means that one should be able to check out how much Luma complex "living" to the next frame is given.

As we know, such complex Luma Parts "Changing/Flickering/flashing" Scenes do rise up the quantisation of an encoder ... like rain, shiny sun reflections on watersurfaces, sparkling diamonts. So I would like to build a routine where such special scenes could be seen by an avisynth function where a filter gets startet when such a -complex Luma uneasy parts- scene will be detected.

Well I think it should work like YDifferenceToNext but not on the whole frame whrer its luma change is detected BUT a Luma difference/complexity out of a 16x16 Matrix of that frame or so similair.

Get my Point? I do hope so .. :)

Thanks in advance!

scharfis_brain
12th August 2004, 18:56
some raw points:

- build an edgemask (example: the sobel) of the current frame
- calculate the difference between two edgemasked neighboring frames (use subtract)
- operate the avgluma of this frame

Didée
13th August 2004, 08:48
incredible, scharfis proposal will get you a little closer to what you want to evaluate. Evaluating a detail-sensitive, noise-insensitive edgemask is waaay better, in this respect, than evaluating the frame as-is.

Little extension: calculating only the edge's luma-diff gives you ~some~ information about absolute motion in the frame, but not about complexity. You'd need to measure the edges itself, as well as the edge diff. between frames, and then would have to build some proportions and relations based on these two.

However, all of that still is a kinda lame attempt. Ideally, it would be needed to do some kind of - more sophisticated - histogram evaluation, preferably (perhaps) in a windowed manner just like you said.

That's one point that still gives me headaches in my Restore24 script. The idea of evaluating the edgemasks to reckognize blends works like a charme (almost impertinent ;) ) - basically.
But much too often it turns out difficult to get the right result out of it, with the currently available metrics only. The eye sees immediately: "yes, the average brightness of the features of this' frame edgemask is darker than that of its neighbors" ... but the simple metric of taking the average luma of the 0.5-gamma'ed edgemask nonetheless may fail. Grrr.

- Didée

Inc
14th August 2004, 11:40
Thanks for your replies!
Ill do some tests this weekend :)