Log in

View Full Version : Levels according to luma ?


lisztfr9
4th May 2012, 20:28
Hi,

I'm looking for a way to reduce the highlights when luma reachs a certain threshold.... in other words, tune levels according to luma, because there was some dazzling effect when the camera was moved in front of white objects, like lamps, mirrors, windows, etc. resulting in haze too.

TIA, l

hanfrunz
7th May 2012, 08:53
have a look at the levels() function.

Mounir
7th May 2012, 19:09
Look at HDRAGC imo:
http://strony.aster.pl/paviko/hdragc.htm

lisztfr9
8th May 2012, 08:42
have a look at the levels() function.

http://avisynth.org/mediawiki/Internal_functions/Runtime_functions

threshold = 55
luma = AverageLuma()
luma < threshold ? Levels(0, 1.0 + 0.5*(threshold - luma)/threshold, 255, 10, 255) : last

One should for each case invent a suitable function to relate luma and gamma...

Solve a system of equations like :

al1 + g1 + b = 0

al2 + g2 + b = 0

f(l) = g

If one want something linear. Otherwise, otherwise :)

Didée
8th May 2012, 08:59
Not that easy. You probably don't want to judge just by the naked luma value. A small Luma=MAX highlight on a glass in a well-lit scene, is something quite different than vast white areas in an overexposed scene. No matter it's the same luma value.

lisztfr9
8th May 2012, 19:33
To increase accuracy, i could divide the frame in 9 squares, and check the luma threshold in each one, like "multi" setting in digital cameras system... multimetering.

http://avisynth.org/mediawiki/The_script_execution_model/Scope_and_lifetime_of_variables

What the script does is to divide a clip (after some processing tweaks) in 4 equal-sized regions and evaluate the average luma of each region per frame. If this is outside a range defined by two thresholds, the corresponding region is turned to all black (if below) or white (if above) for that frame.

Ok, i have to understand that code.