2
$\begingroup$

I am following the open-cv tutorial and they claim that:

In HSV, it is more easier to represent a color than RGB color-space.

after which they convert the image from BGR color model to HSV, claim some color region as blue and bitmask based on that.

My question is: why is it easier to represent color in HSV model?

$\endgroup$
2
$\begingroup$

Say you have an object that is blue, and you adjust the brightness of a lamp in the room, or you move the object so that it does not get as much light. In RGB, all the three components (red, green, blue) will change but in HSV mostly the V (value) component changes. So to recognize pixels belonging to the object by its color, you only need the H (hue) and S(saturation) components of HSV, in contrast to needing all three components of RGB.

Well actually for almost black pixels the H and S components can be anything due to noise, so you will need to see that V is high enough. An equivalent check needs to be done with RGB too.

$\endgroup$
2
$\begingroup$

HSV decomposes colors into hue, saturation and value components. This representation allows us to select color ranges in more natural way. For example, you can select wider range for the value component, making your application less sensitive to the light conditions.

In the example from your link they define lover_blue and upper_blue as the bounds and use inRange function to create the mask. To visualize it a little bit more take a look at this picure: hsv range

In the picture above the saturation is 255 for the lower and upper bounds. But I hope it makes it a little bit clearer.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.