Reputation: 79
I can't understand the difference between HSL and HSI. Are they the same? Do you use the same algorithm to convert RGB -> HSL and RGB -> HSI?
Upvotes: 3
Views: 4183
Reputation: 3126
Here's a comparison between HSV / HSL / HSI color spaces. I think it's important to keep in mind that these models come from a projection of the RGB cube. For more details on this, check the Wikipedia page (specially this figure) and this answer on Stack Overflow.
Their hues are approximately the same. For HSI [1]:
in which v_x
and v_y
are the coordinates from the resulting RGB vector and R
, G
and B
were already normalised to the range [0,1] (i.e. divide the values from the range [0,255] by 255).
If v_y<0
, the correction H = 360° - θ
is needed (otherwise, H = θ
).
You may also find different formulae/algorithms depending on the text, but wielding same results.
For HSL and HSV, we first calculate the (normalised) chroma: C = M - m = max(R,G,B) - min(R,G,B)
(again, with RGB already normalised to the range [0,1]).
Then we use the piece-wise formulation:
Finally, H = H' * 60°
. If C = 0
, we may declare H = 0°
.
The expressions for saturation and value/lightness/intensity are shown below:
Saturation and V/L/I figures source: Wikipedia
[1] Rafael C. Gonzalez, Richard E. Woods. Digital Image Processing, 4ed. New York, NY: Pearson. 2018. ISBN-13: 9780133356724. sec. 7.2: Color Models.
Upvotes: 4
Reputation: 46882
They are not the same. You cannot use the same functions to convert from RGB.
Upvotes: -1