Why Do We Use The HSV Colour Space So Often In Vision And Image ...
Có thể bạn quan tâm
-
- Home
- Questions
- Tags
- Users
- Jobs
- Companies
- Unanswered
- Teams
Ask questions, find answers and collaborate at work with Stack Overflow for Teams.
Try Teams for free Explore Teams - Teams
-
Ask questions, find answers and collaborate at work with Stack Overflow for Teams. Explore Teams
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Learn more about Teams Why do we use the HSV colour space so often in vision and image processing? Ask Question Asked 12 years, 5 months ago Modified 2 years, 9 months ago Viewed 110k times 78 $\begingroup$I see the HSV colour space used all over the place: for tracking, human detection, etc... I'm wondering, why? What is it about this colour space that makes it better than using RGB?
Share Improve this question Follow asked Jun 22, 2012 at 13:41 porridgeporridge 7811 gold badge6 silver badges3 bronze badges $\endgroup$ 2- 3 $\begingroup$ This is a very good question. In my opinion, it would benefit from being a bit more detailed: what is HSV, what is RGB. As most answers are comparing HSV to RGB, the title could be rephrased to compare these two color spaces. $\endgroup$ – PhilMacKay Commented Oct 19, 2012 at 20:45
- 2 $\begingroup$ Another good question might be, "Why is HSV being used all over the place instead of HSL?" $\endgroup$ – posfan12 Commented Oct 24, 2016 at 18:05
9 Answers
Sorted by: Reset to default Highest score (default) Date modified (newest first) Date created (oldest first) 71 $\begingroup$The simple answer is that unlike RGB, HSV separates luma, or the image intensity, from chroma or the color information. This is very useful in many applications. For example, if you want to do histogram equalization of a color image, you probably want to do that only on the intensity component, and leave the color components alone. Otherwise you will get very strange colors.
In computer vision you often want to separate color components from intensity for various reasons, such as robustness to lighting changes, or removing shadows.
Note, however, that HSV is one of many color spaces that separate color from intensity (See YCbCr, Lab, etc.). HSV is often used simply because the code for converting between RGB and HSV is widely available and can also be easily implemented. For example, the Image Processing Toolbox for MATLAB includes functions rgb2hsv and hsv2rgb.
Share Improve this answer Follow edited Feb 15, 2014 at 20:27 answered Jun 22, 2012 at 15:38 DimaDima 5,10123 silver badges28 bronze badges $\endgroup$ Add a comment | 49 $\begingroup$The color information is usually much more noisy than the HSV information.
Let me give you an example: Me and some friends were involved in a project dealing with the recognition of traffic signs in real scene videos (noise, shadows and sometimes occlusion present). It was a part of a bigger project, so that allowed us time to try out different approaches to this particular problem (and re-use older approaches). I did not try color-based approach myself, but I remember an interesting information: _The dominant RGB component in a STOP sign was often not red! (mostly due to shadows)
You can frequently get better information from a HSV colorspace. Let me try and give a personal experience example again: Try imagining you have an image of a single-color plane with a shadow on it. In RGB colorspace, the shadow part will most likely have very different characteristics than the part without shadows. In HSV colorspace, the hue component of both patches is more likely to be similar: the shadow will primarily influence the value, or maybe saturation component, while the hue, indicating the primary "color" (without it's brightness and diluted-ness by white/black) should not change so much.
If this explanations do not sound intuitive to you, I suggest:
try and better understand components used to represent a color in HSV colorspace, and renew your knowledge of RGB
try and see the reasons why these kinds of color representation were developed: it is always in some way, based on some view of human interpretation of color
e.g. children do not actually like highly colored == valued objects, they prefer highly saturated objects, objects in which the color is intense and non-diluted
after you get this and develop some intuition, you should play with images: try decomposing various images in their R-G-B and H-S-V components
Your goal would be to see and understand a difference in these decompositions for images that contain shadows, strong illumination, light reflection.
if you have a particular type of images you like to play with, try decomposing them: who knows, maybe RGB is really more suited for your needs than HSV :)
- 1 $\begingroup$ If it is a shadow, it should change only brightness - not saturation. $\endgroup$ – Andrey Rubshtein Commented Oct 18, 2012 at 16:02
- $\begingroup$ @Andrey as I said, I did not work on the color-based approach myself, but I can speculate that if was not only a shadow -- probably some indirect lighting from the surroundings or something similar also played a role. $\endgroup$ – penelope Commented Oct 19, 2012 at 8:24
- 1 $\begingroup$ You are right. However, in the case of indirect lighting the Hue might change as well. $\endgroup$ – Andrey Rubshtein Commented Oct 19, 2012 at 9:09
- 1 $\begingroup$ @Andrey Hence my wording: "more likely", "similar", "primarily influence", ... After all, I was not explaining HSV, just giving some examples and educated guesses based on experience. And, the best way to choose the most suited color-space for any application is to play around with your image database and different color-spaces $\endgroup$ – penelope Commented Oct 19, 2012 at 9:46
- 3 $\begingroup$ Anything in shadow and hence not lit by the primary light source (the sun) is being lit by the secondary light source - the sky, which is a giant, bright, and very blue light. To human eyes red still looks red since our eyes make relative color measurements instead of absolue color, which is why your indoor, non-flash photos look more yellow than you think they should. And I am in absolute agreement about playing around with your actually image database. $\endgroup$ – John Robertson Commented Nov 6, 2012 at 16:33
Using only the Hue component makes the algorithm less sensitive (if not invariant) to lighting variations.
Another popular option is LAB color space, where the AB channels represent the color and euclidean distances in AB space better match the human perception of color. Again, ignoring the L channel (Luminance) makes the algorithm more robust to lighting differences.
Share Improve this answer Follow answered Jun 22, 2012 at 15:33 nimrodmnimrodm 8861 gold badge6 silver badges10 bronze badges $\endgroup$ Add a comment | 8 $\begingroup$The best answer I can figure is: RGB has to do with "implementation details" regarding the way RGB displays color, and HSV has to do with the "actual color" components. Another way to say this would be RGB is the way computers treats color, and HSV try to capture the components of the way we humans perceive color.
I'll elaborate:
Color is a perception based on electromagnetic waves. Natural properties of these waves are,for example intensity and frequency. If we sweep the frequency of a lightwave from infra-red to ultra-violet, we would visually perceive a color variation along the rainbow colors. Rainbow colors could be considered "pure colors" because they are represented by single-frequency waves.
Now the human eye can only respond, or "resonate" to three main light frequencies, not surprisingly red, green and blue. The fact is that this response is non-linear, so the retina can distinguish a given pure color (and implicitly its "frequency") by the combined response of the three color components.
The RGB color space exists as such only to mimic the internal workings of our retina, so that a vast majority of colors can be represented on computer displays by means of a convenient (from a computer point of view) 24 bits-per-pixel color coding. The RGB color space has no intrinsic relation to the natural color properties, neither to human interpretation of color.
For example, any arithmetical operation performed channel-wise in RGB space (for example, generation of color gradients) gives very crude or even plainly "wrong" results. That's why it is advised to create colormaps by converting the color stops from RGB to other color spaces (HLS, Lab, etc.), performing the interpolations, then converting the interpolated values back to RGB.
Hope this helps!
Share Improve this answer Follow answered Jun 23, 2012 at 1:22 heltonbikerheltonbiker 1,09711 silver badges22 bronze badges $\endgroup$ 2- 2 $\begingroup$ I'd disagree. There are three domains, not two: human, computer and physics. The RGB model is derived from the human eye, which has three color receptors. $\endgroup$ – MSalters Commented Jul 5, 2012 at 15:40
- $\begingroup$ @MSalters I think we are talking about the same things (although perhaps I haven't made myself completely clear). The RGB displays are made to match our color-perception system. They have a computer counter-part, the (R,G,B) "coordinates". Since these coordinates map to implementation rather to the physical, "real nature" properties of color, they are not suited to perform some mathematical processing, e.g. perceptually linear gradient interpolation, color correction, brightness and saturation ops, etc. $\endgroup$ – heltonbiker Commented Jul 5, 2012 at 17:11
As others mentioned, it is beneficial to separate the luma from the chroma. The luma varies greatly in the scene based on the amount of light falling on the object. Chroma, on the other hand, correlates better with the object's intrinsic properties, and for properly white-balanced images is more-or-less invariant.
However, I would like to add that HSV, HSL, or in fact any color space with polar parametrization of the chroma plane, are bad choices for that purpose. That is because they introduce a singularity on the line of grays (which hue is gray?), making them very sensitive to noise and white-balance. Additionally comparing between two colors in a polar coordinate system isn't as straight forward. Also note that neither the value in HSV nor lightness in HSL correspond to the human perceived lightness or any other physical measure of energy.
There are plenty of linear color spaces that give the same luma-chroma separation while preserving linearity (YCbCr, YUV) or model human vision properly (LUV, LAB). With those you can compare two colors using a Euclidean L2 norm on their chromaticities, resulting in a more robust algorithm overall.
Why HSV/HSL are used so often then? Hard to give an objective answer. From my experience it's mostly due to ignorance and the availability of RGB->HSV conversion routines. Had to work with code whose authors didn't understand gamma-correction, let alone different color-spaces. Seen code that converted RGB to HSV then segmented the image based on the hue, disregarding the fact that it's a modular quantity. I think we can agree that those weren't conscious decisions backed by any reason.
Share Improve this answer Follow answered Sep 22, 2019 at 21:49 ybungalobillybungalobill 2291 silver badge5 bronze badges $\endgroup$ Add a comment | 2 $\begingroup$HSV stands for Hue-Saturation-Value. It is actually a type of color plane representation (like RGB, YCbCr etc.).
It is a device independent color representation format: The HSV color representation is useful to detect specific color types, e.g.: skin color, fire color etc.
Matlab function to convert an RGB image to HSV plane is rgb2hsv('/inputimage_name').
Share Improve this answer Follow edited Feb 19, 2014 at 12:49 penelope 3,6761 gold badge27 silver badges67 bronze badges answered Feb 19, 2014 at 11:44 NishNish 211 bronze badge $\endgroup$ Add a comment | 2 $\begingroup$There is nothing I know of that is especially better with HSV as compared to YUV or LAB that would make it better for the feature extraction and illumination invariance or visualization. I guess HSV is the more commonly used one because of convention and continuity: its easier to compare results and communicate with each other if you both use the same colorspace.
With that said, HSV (as opposed to RGB) is used in computer vision for 2 reasons I know of:
- Visualization. Whenever you have directional information densely over an image, then HSV is a good color space for visualization. Instead of plotting little vectors over an image(they will clutter everything), you can plot color with HSV, by putting the directional vector mapped to the H (vector angle) and S(vector magnitude). This leaves the Value component, which can be set in any number of ways depending on what you want to achieve. See below example from the middlebury optical flow dataset. HSV is used to display directions densely.
- Feature extraction and illumination invariance, as explained in the other answers.
I will give you an example to understand. Like our hand has many parts palm, back palm, and below that. we can see different color variation in these areas, but the hue for all these regions don't vary much, so hue value can be useful in hand segmentation.
Share Improve this answer Follow answered Jul 5, 2012 at 3:22 crack_addictcrack_addict 3012 silver badges9 bronze badges $\endgroup$ Add a comment | -1 $\begingroup$HSV color model is more correlated to how humans see colored objects, as compared to RGB, YUV, Lab etc.
We see what color the object is (Hue), how much is it saturated (Saturation) and how much white light is falling on it (Intesity).
Share Improve this answer Follow answered Jul 9, 2019 at 5:23 DeepakDeepak 11 bronze badge $\endgroup$ Add a comment |Your Answer
Thanks for contributing an answer to Signal Processing Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
Use MathJax to format equations. MathJax reference.
To learn more, see our tips on writing great answers.
Draft saved Draft discardedSign up or log in
Sign up using Google Sign up using Email and Password SubmitPost as a guest
Name EmailRequired, but never shown
Post Your Answer DiscardBy clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.
Not the answer you're looking for? Browse other questions tagged
or ask your own question.- The Overflow Blog
- Your docs are your infrastructure
- Featured on Meta
- More network sites to see advertising test [updated with phase 2]
- We’re (finally!) going to the cloud!
Linked
4 Resources for an introduction to computer vision 9 Segmenting pills from the background 2 Problem with HSV and RGB color model 2 What are the tradeoffs in HSB and HSV versus CIE color models in computer vision?Related
14 basic hsb skin detection, neon illumination 11 Understanding Cb and Cr Components of YCbCr Color Space 11 Image processing and the Fourier Transform 0 OpenCV camshift algorithm 6 How to choose the most appropriate color space for a computer vision application? 4 what does it mean to have a decorrelated colour space? 1 Why is the green colour not represented as black in Cr component of YCbCr? 5 Is HSV Color Space Sufficient for Rudimentary Color ID and Edge DetectionHot Network Questions
- Identifying a TNG episode where Dr. Pulaski instructs another doctor on a sling
- Skylab's Boom during EVA
- How to reorder pages after rendering?
- How much ebikes actually benefit from ebike specific wheels, tires, and forks?
- Configure Linux to regularly sync cached data to disk
- Why didn't Steve Zahn receive a credit for Silo?
- How can I solve my equation with the best numerical precision?
- What mechanism could cause a person not to cast a reflection?
- Will a laptop battery that stays connected to its charger be damaged?
- Walks in Nice (Nizza)
- What's a good way to append a nonce to ciphertext in Python for AES GCM in Python?
- What's the Purpose of the IRQ on a 6502
- How do I add a trusted check constraint quickly
- What powers do police have to force people onto trains?
- If someone’s words are likely to be disregarded, how to describe the quality of “meaning” they lack?
- Do market-makers often act as a taker in other markets or assets while hedging?
- Sorites paradox and emergence
- Angular orientation of exact solution of the Hydrogen Schrödinger Equation
- How can I politely decline a request to join my project by a free rider professor
- How can I avoid overusing her/she or the character name when describing character action
- Why is Ukraine's conscription age (still) so high (25)?
- Why is bash startup executed under non-interactive ssh
- Likely source of a hot-cold crossover?
- How important is storytelling when submitting a grant application (or even a science paper)?
To subscribe to this RSS feed, copy and paste this URL into your RSS reader.
Từ khóa » Hsv Color Model Advantages And Disadvantages
-
HSV (Hue, Saturation And Value) - The Tech-FAQ
-
(PDF) Color Spaces Advantages And Disadvantages In Image Color ...
-
Advantages And Disadvantages Of Color Spaces | Download Table
-
HSL & HSV Colour Models - SlideShare
-
Difference Between RGB, CMYK, HSV, And YIQ Color Models
-
HSL And HSV - Wikipedia
-
[PDF] Understanding Color Models: A Review - Robert Haralick
-
Why I Love HSV, And Why It's Totally Useless - Howlett Studios
-
Advantages And Disadvantages Of RGB And CMYK Color Model
-
Why Use An HSV Image For Color Detection Rather Than An RGB Image?
-
Color Spaces Advantages And Disadvantages In Image Color ...
-
The Application Of Improved HSV Color Space Model In Image ...