Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is HSL Superior over HSI and HSV Color Spaces?

Is HSL superior over HSI and HSV, because it takes human perception into account.? For some image processing algorithms they say I can use either of these color spaces, and I am not sure which one to pick. I mean, the algorithms just care that you provide them with hue and saturation channel, you can pick which color space to use

like image 438
user1509260 Avatar asked Jul 09 '12 14:07

user1509260


People also ask

What is the difference between HSV and HSL?

The difference between HSL and HSV is that a color with maximum lightness in HSL is pure white, but a color with maximum value/brightness in HSV is analogous to shining a white light on a colored object (e.g. shining a bright white light on a red object causes the object to still appear red, just brighter and more ...

Is HSL the same as HSI?

The representations HSV, HSI and HSL are very similar, but not completely identical. The hue component H in all three color spaces is an angular measurement, analogous to position around a color wheel. A hue value of 0°corresponds to red, 120° corresponds to green, and 240° corresponds to blue.

What is the difference between HSI and HSV?

HSV then takes the chroma and divides it by the value to get the saturation: C/V . HSL divides chroma by an expression taking lightness into account: C/(1-abs(2L-1)) . HSI doesn't use chroma, instead only taking min(R,G,B) into account: min(R,G,B)/I .

What is the advantage of HSV Colour space over RGB?

HSV is a cylindrical color model that remaps the RGB primary colors into dimensions that are easier for humans to understand.


3 Answers

Which one is best very much depends on what you're using it for. But in my experience HSL (HLS) has an unfortunate interaction between brightness and saturation.

Here's an example of reducing image brightness by 2. The leftmost image is the original; next comes the results using RGB, HLS, and HSV:

RGB, HLS, HSV comparison

Notice the overly bright and saturated spots around the edge of the butterfly in HLS, particularly that red spot at the bottom. This is the saturation problem I was referring to.

This example was created in Python using the colorsys module for the conversions.

like image 109
Mark Ransom Avatar answered Oct 02 '22 21:10

Mark Ransom


Since there is no accepted answer yet, and since I had to further research to fully understand this, I'll add my two cents.

Like others have said the answer as to which of HSL or HSV is better depends on what you're trying to model and manipulate.

tl;dr - HSV is only "better" than HSL for machine vision (with caveats, read below). "Lab" and other formal color models are far more accurate (but computationally expensive) and should really be used for more serious work. HSL is outright better for "paint" applications or any other where you need a human to "set", "enter" or otherwise understand/make sense of a color value.

For details, read below:




If you're trying to model how colours are GENERATED, the most intuitive model is HSL since it maps almost directly to how you'd mix paints to create colors. For example, to create "dark" yellow, you'd mix your base yellow paint with a bit of black. Whereas to create a lighter shade of yellow, you'd mix a bit of white.

Values between 50 and 0 in the "L" spectrum in HSL map to how much "black" has to be mixed in (black increasing from 0 to 100%, as L DECREASES from 50 to 0).

Values between 50 and 100 map to how much "white" has to be mixed in (white varying from 0 to 100% as L increases from 50 to 100%).

50% "L" gives you the "purest" form of the color without any "contamination" from white or black.


Insights from the below links:
1. http://forums.getpaint.net/index.php?/topic/22745-hsl-instead-of-hsv/ The last post there.
2. http://en.wikipedia.org/wiki/HSL_and_HSV Inspect the color-space cylinder for HSL - it gives a very clear idea of the kind of distribution I've talked about.

Plus, if you've dealt with paints at any point, the above explanation will (hopefully) make sense. :)


Thus HSL is a very intuitive way of understanding how to "generate" a color - thus it's a great model for paint applications, or any other applications that are targeted to an audience used to thinking in "shade"/"tone" terms for color.




Now, onto HSV.

This is treacherous territory now as we get into a space based on a theory I HAVE FORMULATED to understand HSV and is not validated or corroborated by other sources.

In my view, the "V" in HSV maps to the quantity of light thrown at an object, with the assumption, that with zero light, the object would be completely dark, and with 100% light, it would be all white.

Thus, in this image of an apple, the point that is directly facing the light source is all white, and most likely has a "V" at 100% whereas the point at the bottom that is completely in shadow and untouched by light, has a value "0". (I haven't checked these values, just thought they'd be useful for explanation).

Thus HSV seems to model how objects are lit (and therefore account for any compensation you might have to perform for specular highlights or shadows in a machine vision application) BETTER than HSL.




But as you can see quite plainly from the examples in the "disadvantages" section in the Wikipedia article I linked to, neither of these methods are perfect. "Lab" and other more formal (and computationally expensive) color models do a far better job.

P.S: Hope this helps someone.

like image 42
Dev Kanchen Avatar answered Oct 02 '22 19:10

Dev Kanchen


The only color space that has advantage and takes human perception into account is LAB, in the sense that the Euclidian metric in it is correlated with human color differentiation.

Taken directly from Wikipedia:

Unlike the RGB and CMYK color models, Lab color is designed to approximate human vision. It aspires to perceptual uniformity, and its L component closely matches human perception of lightness

That is the reason that many computer vision algorithms are taking advantage of LAB space

HSV, HSB and HSI don't have this property. So the answer is no, HSL is not "superior" over HSI and HSV in the sense of human perception.

If you want to be close to human perception, try LAB color space.

like image 39
Andrey Rubshtein Avatar answered Oct 02 '22 21:10

Andrey Rubshtein