New local contrast tool

Hi Carmelo_DrRaw i think that the adobe’s clarity probably is a local contrast in the luminance channel and some kind of desaturation similar to the darktable’s chroma scaling in the LAB curve tool.
While darktable use the formula(i’m not sure :thinking:) :
sat=Lout/Lin
L=Lout
a=a * sat
b=b * sat

For a generic clarity tool it could be modified in this way:

sat=min(Lout/Lin,Lin/Lout)
L=Lout
a=a * sat
b=b * sat

The RGB equivalent is:

sat=min(Lout/Lin,Lin/Lout)
[(RGB/Lout)^sat]*Lout

I’m testing this command in G’mic with two layers, the original image and the one with local contrast applied:
-fill lout=((0.2126i0#0)+(0.7152i1#0)+(0.0722i2#0));lin=((0.2126i0#1)+(0.7152i1#1)+(0.0722i2#1));sat=min(lin/lout,lout/lin);((i#0/lout)^sat)*lout

Local contrast from Photoflow

Local contrast + chroma reduction

Adobe clarity

Sorry for the slighty OT :sweat_smile:

1 Like