Algorithm for Hue correction behind HSL sliders in image processing software

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

Initial image.

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

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.

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.

• It might work spatially, namely create a mask based on the hue and then make things smooth spatially. Have you tried?
– Royi
Jan 11 at 6:41
• @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. Jan 20 at 18:03
• Great! It might be nice if you post an answer with the code. I will +1 it.
– Royi
Jan 20 at 20:02
• – Royi
Jul 8 at 19:49