Thanks Aurélien!

Formula changed, new version on Git ready for testing: https://github.com/kbarni/darktable (please test especially the OpenCL kernel, as I don't have the hardware to test it!)

On 11/10/2019 16:57, Aurélien Pierre wrote:
Actually, I made a mistake. The formula I gave you will produce hue shifts.

If you think about it, saturation means "how rich the colour is", which translates in math by "how far the RGB components are from their corresponding luminance", so adjusting the saturation means rescaling the difference ({ RGB } - Y) around Y (that's what Y+saturation*(pixel-Y) does).

The idea of vibrance is to do the same, but with a penalty for colours that are already rich. Power-like functions are great at doing that (for powers < 1) : you get a large correction close to 0, and small correction close to 1. However, doing so, you need to ensure the 3 components get the same ratio of correction, otherwise hue will shift (and the formula I gave you will likely make hues shifts to blue).

*{ RGB } = Y + saturation * ( ( Y * ({ RGB } / Y)^vibrance - Y)) *should behave as expected, and you can factorize it as *Y * ( 1 + saturation * (({ RGB } / Y)^vibrance - 1))*. Basically, you scale by Y before applying the power. It's the same logic as the fulcrum contrast. You need to be sure that Y is non-zero though (but if Y == 0 at this point of the pipe, something is seriously screwed before).


___________________________________________________________________________
darktable developer mailing list
to unsubscribe send a mail to darktable-dev+unsubscr...@lists.darktable.org

Reply via email to