View Single Post
Old 30th June 2018, 23:07   #19  |  Link
Bernardd
Registered User
 
Join Date: Jan 2012
Location: Toulon France
Posts: 249
Hello
New script version. Better luma process.
It is a manual white balance, you must tune the args.

The script args are :

comparison = boolean arg to show differents settings output
show_scrutinized = boolean arg to show the scrutinized aera
show_info = boolean arg to show extracted and comptuted datas

matrix = "Rec601" or "Rec709" to choice the color conversion matrix
x = float arg to specify the left of scrutinized aera
Y = float arg to specify the top of scrutinized aera
w = float arg to specify the right of scrutinized aera
h = float arg to specify the bottom of scrutinized aera

threshold = float arg to specify extreme pixels percentage to be ignored when datas extraction

gain_strength = float arg to enable gain process and increase his strength
cont_strength = float arg to enable contrast process and increase his strength
cont_adapt = float arg to adapt contrast bias
bias_gamma = boolean arg to enable bias and gamma white balance process
bias_strength = float arg to enable bias process and increase his strength
gamma_strength = float arg to enable gamma process and increase his strength
cont_adapt2 = is the same arg as cont_adapt, but its vlaue is used when bias and gamma white balance is enable
spow = boolean arg to enable spow process
pord = boolean arg to secify order of rpow and spow process
spmid_strength = float arg to adapt spimd
temperature = float arg to increase or decrease color temperature

The script calculate for each color channel,
- the classic autogain with a gain bias to keep the value between 0 to 255
- the contrast, with gain formula and a cont bias to aviod a visual bad offset
- a bias to keep the luma value after gain and or contrast application
- in accordance with the grey world theory a bias to get the same value of color channel average
- in accordance with the grey world theory a rpow float number
- a spow float number with the rpow formula
- a spmid number to specify inflexion point of the s curve

Cont_adapt, cont_adapt2, bias_gamma, pord and temperature are not computed. They are operator choices.

The operator can modify, adjust the computed results by increasing or decreasing gain, contrast, bias and gamma strengths and cont adapt.
The operator can choice the combination of process. Gain, contrast, bias and gamma strengths desable process when their values are null.

Nota : For gain and contrast strengths = 0.0, gain and contrast factors = 1.0 and gain bias and contrast bias = 0.0.
But, for gain and contrast strengths = 0.1, gain and contrast factors are near to 1.0, but gain and contrast bias are not null. For sample, if
the min value of one color channel is 100, the bias for gain is -100.

The perform of this script is the contrast bias use. The operateur can tune cont_adapt2 (or cont_adapt if only gain and contrasts process are
selected) to get the best contrast bias.
For some videos, it is possible to get a readable white balance with only gain and contrast process.
For other video, you must use classical bias and gamma process. The arg tunes are manual

With the boolean arg bias_gamma, you can make a fast comparison between gain and contrast result and result of combination of gain, contrast, bias and gamma .

The default args give a readable output with "lena" color cast sample picture. But it can be better. First decrease or increase cont-adapat2.

The script have always a comparison display mode to help to find the better combination of actions.
This mode show nine output of the video.
Top, from left to right, gain action only, gain and bias actions, followed by gain, rpow and bias actions.
Middle, from left to right, original input, AutoWhite ColorYUV process, and the tuned script output.
Bottom, from left to right, default modes without gain, and without cont, default modes without gain and default modes all process.

Comment
If you use AvsPmod, you can uncomment lines 45 to 76 to have UserSliders facility.

The script here in attachment
and here https://www.dropbox.com/s/lhvwqufa8h...0juil.avs?dl=0


Bernard
Attached Files
File Type: txt RGBAdapt_Awb_Process v 2018 juil.txt (54.4 KB, 68 views)

Last edited by Bernardd; 30th June 2018 at 23:10.
Bernardd is offline   Reply With Quote