I have a project where i need to recreate hue specific hue adjustment sliders like in Lightroom/Capture One/DxO photolab.

Like these

Initial image. Image before hue shift

Image after hue adjustment (Orange hue range) in DxO Photolab. Image after hue shift(Orange hue)

After some research i found that they seem to use smoothstep function to smooth transition. I designed a function that can handle this (Smoothstep with absolute values of x, where x is the hue value).

$ k = max(0,min(1,\frac{\left| hue - t_{3}\right|-t_{1}}{t_{2}-t_{1}}))$

where t1, t2, t3 are arbitrary that i found through observation. They are used to select target range.

And smoothstep goes like this

$ factor = k^{2}(3-2k) $

Saturation and Lightness sliders work with smoothing as inteded but when i shift hue using

$ NewHue = OldHue + factor * AddHueValue $

I get ugly results with different smoothing.

My way of shifting hue

I tried to interpolate between old hue and new hue using near hue interpolation but that doesn't seem to show the same results as from refernece.

Could you possibly give me some advice on how to approach this problem? Is there something i missed? Is there any other hue interpolation algorithms that can be used in this situation? Or could you recomend book or article on implementing something like this?

Thank you very much.

  • $\begingroup$ It might work spatially, namely create a mask based on the hue and then make things smooth spatially. Have you tried? $\endgroup$
    – Royi
    Jan 11, 2023 at 6:41
  • $\begingroup$ @Royi Thank you very much for answering. I got it working. As it turned out HSL color space is not suitable for hue interpolation because HSL is not a perceptualy uniform color space. I replaced HSL with LCh and it worked perfectly. $\endgroup$
    – BershadoVv
    Jan 20, 2023 at 18:03
  • $\begingroup$ Great! It might be nice if you post an answer with the code. I will +1 it. $\endgroup$
    – Royi
    Jan 20, 2023 at 20:02
  • $\begingroup$ Related dsp.stackexchange.com/questions/688 and dsp.stackexchange.com/questions/15785. $\endgroup$
    – Royi
    Jul 8, 2023 at 19:49


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.