View Full Version : histogram for adjusting brightness and contrast
Wilbert
8th April 2003, 15:17
I would like to have your opinions about how to use histogram for adjusting brightness and contrast.
my idea:
Add the histogram filter (applied to your clip) to your script and open it in VirtualdubMod (switch to the script editor). The histogram shows the luminance of your clip. It woks like this: if the white "bar" is moved to the left (that is no black space between clip and this bar) it means that that part of the frame is black. If there is a very bright spot on a part of the frame, it means that the "bar" is moved to the right end of the histogram.
Look up a frame which contains a very dark part (that should be easy if the clip has black borders :). Add the tweak filter to your script and lower/higher the brightness till the "bar" has moved to the left at that dark part, and write down the frame number you used. Next, look up a frame which contains a very bright part. Lower/higher the contrast till the "bar" has moved to the right at that bright part, and write down the frame number you used.
Go back to the original frame [black part] and adjust the brightness again if necessary, and go back to the second frame [bright part] and adjust the contrast if necessary.
Is this the right way for correcting the brightness and contrast using the histogram, or is there an easier/better/more accurate way ?
wotef
8th April 2003, 15:27
that sounds interesting
the code behind coloryuv("analyze"=true) may help in terms of metrics
Wilbert
8th April 2003, 15:36
coloryuv("analyze"=true)
Thanks, will look at that.
Now that I'm reading the docs of coloryuv, I read:
Autogain can be true or false. This setting will use the information from the analyzer, and attempt to create as good contrast as possible. That means, it will scale up the luma (y) values to match the minimum and maximum values. This will make it act much as an "autogain" setting on cameras, amplifying dark scenes very much, while leaving scenes with good contrast alone. Some places this is also refered to as "autolevels".
Is it similar, does this correct the brightness and contrast? Guess I have to try it.
sh0dan
8th April 2003, 17:32
In YV12 the histogram furthermore highlights invalid Y-values (making them brown/yellowish). This might indicate that you have to use the limiter, or do further adjustments with coloryuv.
lamer_de
8th April 2003, 22:39
uh, this is pretty much the thing I'm trying to do.
I have some clips which are very "pale", and I want to "color up" them. I was using the ColorYUV(autogain=true) function, but it doesn't work for fades. Somehow the changing brightness confuses the filter and pretty much f*cks up the image (way too much white etc.).
So I'd like to find out the values I have to enter in the Tweak filter to apply the right brightness/white point/black point shift without killing those sensitive scenes. Till now, I failed miserably. :o
Is there a way to get these values out of the comparison of the autoleveled and original frame ?
TIA,
lamer_de
Wilbert
9th April 2003, 10:00
About this Autogain option: Does it adjust brightness/contrast on framebasis, or does it look at the whole clip? I guess it does the first, but isn't the second better?
sh0dan
9th April 2003, 11:49
@wilbert: It does it on a pre-frame basis. As said in the docs - it is not very intelligent, and only to be used for clips that already are bad.
@lamer_de: Autogain only gains luma, and not chroma - as most often just leads to massive chroma gain artifact. It is only to be used on a single scenes, which are quite bad. I personally found it useful for getting something useful out of material we recieved that was shot under very poor lighting conditions.
You should IMO use ColorYUV to adjust your brightness/white point/black point shift - look in the docs for parameters.
Use "off_y" to set black point.
Use "gain_y" or "cont_y" to set contrast. IMO gain gives nicer results.
To apply the same "gain" values to uv, use:
chroma_gain = 16
luma_gain = 24
ColorYUV(gain_u=chroma_gain, off_u = chroma_gain/2,gain_v=chroma_gain, off_v = chroma_gain/2)
Wilbert
9th April 2003, 13:35
To apply the same "gain" values to uv, use:
chroma_gain = 16
luma_gain = 24
ColorYUV(gain_u=chroma_gain, off_u = chroma_gain/2,gain_v=chroma_gain, off_v = chroma_gain/2)
I guess I should be able to understand this, but I don't. Why do they have the same gain values here? Why do you use offsets (and why gains/2)?
wotef
9th April 2003, 13:50
i also find the parameters for this filter very confusing
you know, if anybody has the skillz to make this into a vdub filter with preview, i'm pretty sure i would geddit :p
lamer_de
9th April 2003, 14:50
You should IMO use ColorYUV to adjust your brightness/white point/black point shift - look in the docs for parameters.
I'm confused how to find out the proper values to enter in the filter.
I'm sure I haven't expressed myself properly, so i'll try again:
I have this as source:source (http://www.kurthost.net/fansubs/raw.jpg) source1 (http://www.kurthost.net/fansubs/raw1.jpg)
I apply colorYUV(autogain=true).Tweak(bright=-4) (the tweak is for cosmetic reasons.In my eyes it looks better this way. It shouldn't matter, as I want to find out the values of the final image anyway) and get this: corrected (http://www.kurthost.net/fansubs/colorcorrected.jpg) corrected1 (http://www.kurthost.net/fansubs/colorcorrected1.jpg)
How do I get the values for black point/white point/black point shift/brightness out of this?
Sorry if this seems trivial to you, but i've never worked with these kinds of things before and don't understand the technique behind it.
I have image manipulation programs like Photo Paint at hand who give me a histogram aswell, but I don't see the values there either.
Well, for now I process fades seperatly, but that is way too much work when you're encoding many eps.
Any help is appreciated.
CU,
lamer_de
vBulletin® v3.8.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.