View Single Post
Old 2nd March 2018, 11:46   #18  |  Link
Bernardd
Registered User
 
Join Date: Jan 2012
Location: Toulon France
Posts: 249
Hello,
New script version which improve process.

First in past i have used a tip to control strength of gain, contrast and gamma process. Thus when i tuned strength to 0.0
gain, contrast and gamma values were 1.0 (neutral). When i tuned strength to 1.0, gain, contrast and gamma values were the
computed values from RGB channels datas. For example the formula for gain was :
gain = 1.0 + (255.0/MinMaxDiff_0 - 1.0) * gain_strength
In manual mode this tip is not a problem, the operator choose the good gain_strength value. But in past, in automatic mode,
i calculated a gain_strength value based on RGB channels datas to decrease, to ponderate the process strength and in this case
the formula is not accurate 1.0 + (255.0/MinMaxDiff_0 - 1.0) * gain_strength is not (255.0/MinMaxDiff_0) * gain_strength, when
gain_strength >0.0 and < 1.0.

Now i used this formula gain = (255.0/MinMaxDiff_0) * (ponderate_factor + gain_strength)
gain_strength is manual adujst arg in range from -1.0 to 1.0 with default 0.0

With the last formulas i have some problem of luma. Thus i was obliged to base the bias calcul on average of RGB channels
averages after gain to recover readable something. With accurate formulas, no luma problem. Thus all process use the RGB
channels values of original clip.

Thus the new script is for color cast correction with five and half process.
action with gain,
action with contrast,
action with one bias and rpow mix,
action with spow,
and the half,only if contrast is enable, action with one final bias to recover luma. (Contrast increase color saturation but
also decrease luma.)

This actions can work together or independantly.

The operator can enable or desable gain, contrast, rpow and spow process with boolean switchs.
He can also adjust the computed strength of gain and contraste with theire strength args.
Bias and Gamma (rpow and spow) process are auto mixed in default mode. The operator can desable this automatic process with
a boolean switch. In this case the operator can tune the bias gamma mix percentage with one arg.
In manual mix mode percentage = 0.0 traduce only gamma process, 1.0 only bias.
For inflexion point of Spow curve, the script compute one automatic spmid by RGB channels, but the operator can adjust these
spmid with a spmid strength arg.

One arg stay always manual. "pord" equal false (default) rpow corrections are computed before spow corrections, true inverse

Gain bias formulas are classic formulas. Gamma formula is a mathematical application of grey world theory. Nota, gain and contrast
are having the same formula, rpow and spow have the same formula.

Automatic ponderation factor for gain and contrast, automatic bias gamma mixed percentage and spmid have formulas choosed after
many personnal tests.

This formulas are choosed for big colors casts like lena or tahiti clip, but i think they give readable output for low colors
casts. But for big colors casts with washed colors, the spmid formula is not the best. In this case i suggest first to decrease the
spmid strength and after to try to adjust bias gamma mix in manual mode.

Below some samples

Lena with default mode and comparaison display and RgbAdapt graffer to show curves.

https://www.dropbox.com/s/cizhhta89k...aison.jpg?dl=0

https://www.dropbox.com/s/4f1t8qb4gw...affer.jpg?dl=0

Tahiti clip with default mode. On this sample we can see problem with contrast. Contrast is necessary to recover color, but we
loose some details in the dark. At the end, red is a little magenta. A little hue with Tweak function can solve this look.
https://youtu.be/y4LSb0pcTsU

Disneyland park. on left half original, on right half default without contrast and on right without contrast but with
decreased spmid strength to 0.6. I do'nt suggest that default without contrast and 0.6 spmid is the good combination, but it is
very fast to find.
https://youtu.be/x6oVh5PmTGk

Comment
If you use AvsPmod, you can uncomment lines 43 to 70 to have UserSliders facility.

The script in attachment
and here https://www.dropbox.com/s/j02xhirllh...20mar.avs?dl=0
Attached Files
File Type: txt RGBAdapt_Awb_Process v 2018 mar.txt (57.3 KB, 84 views)
Bernardd is offline   Reply With Quote