Log in

View Full Version : Auto level speculation


anton_foy
13th November 2024, 17:56
Using ColorYUV(autogain=true) renders an incorrect representation of the colors as it seems to just adjust the Y-channel and " histogram stretching" (if that even is the correct term) is not applied to the other channels. The saturation will then take a blow if the image is dark. I would think that doing this in rgb would be better since I had some success using python to code and get some good results.This is the first point I want to highlight but the main point is that ColorYUV(autogain=true) has problems with flickering and I would speculate that it could be avoided if the code would analyze a downscaled (bicubic or bilinear maybe) version of the image to lets say 64x48 or similar resolution in order to more smoothly skip the small fluctuations in luminance. Is my logic totally off in this reasoning?

Not to forget, also some kind of limiting or highlight roll-off would be great since autogain cuts off too much information in the highlights. I am aware that "ex_autolevels" can give good results in this area but I believe a more simple solution could be available aswell.

takla
14th November 2024, 07:52
Yeah sounds good.

Other solutions:
1) Average across multiple frames for more temporal stability.

2) Build a palette and only alter the 32 most common "colors".

3) Add scenechange detection and discard frames above X average threshold.

anton_foy
14th November 2024, 10:25
2) Build a palette and only alter the 32 most common "colors".
Interesting! Can you explain this a bit further?

takla
14th November 2024, 11:55
Interesting! Can you explain this a bit further?

https://i.imgur.com/0F3Rlvo.jpeg

https://forum.doom9.org/showthread.php?t=174358

Basically you grab those colors, build a bilinear interpolation mask around them as a pseudo falloff, and auto-level them (with close by colors from the mask having maybe 50% of the gain)

anton_foy
15th November 2024, 11:31
Okay cool but then the palette has to change during the shot/scene? Some sort of temporal transitioning of one palette to another based on key frames or so?

takla
17th November 2024, 12:54
Okay cool but then the palette has to change during the shot/scene? Some sort of temporal transitioning of one palette to another based on key frames or so?

Correct. Ideally you always want scenecut detection/averaging/threshold discarding.

By design, auto-levels with a masked palette would always give you the most stable image.

And then you probably also want to reduce the strength of color change above a certain panning shots speed.