Why Do We Convert From RGB To HSV - Opencv - Stack Overflow

    1. Home
    2. Questions
    3. Tags
    4. Users
    5. Companies
    6. Labs
    7. Jobs
    8. Discussions
    9. Collectives
    10. Communities for your favorite technologies. Explore all Collectives

  1. Teams

    Ask questions, find answers and collaborate at work with Stack Overflow for Teams.

    Try Teams for free Explore Teams
  2. Teams
  3. Ask questions, find answers and collaborate at work with Stack Overflow for Teams. Explore Teams

Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

Get early access and see previews of new features.

Learn more about Labs Why do we convert from RGB to HSV Ask Question Asked 11 years, 5 months ago Modified 7 years, 5 months ago Viewed 35k times 17

I have a image and i want to detect a blue rectange in it. My teacher told me that:

  • convert it to HSV color model
  • define a thresh hold to make it become a binary image with the color we want to detect

So why do we do that ? why don't we direct thresh hold the rgb image ? thanks for answer enter image description here

Share Improve this question Follow edited Jun 12, 2013 at 10:30 kerry_13 asked Jun 12, 2013 at 10:20 kerry_13's user avatar kerry_13kerry_13 2891 gold badge3 silver badges12 bronze badges Add a comment |

4 Answers 4

Sorted by: Reset to default Highest score (default) Trending (recent votes count more) Date modified (newest first) Date created (oldest first) 17

You can find the answer to your question here

the basic summary is that HSV is better for object detection,

OpenCV usually captures images and videos in 8-bit, unsigned integer, BGR format. In other words, captured images can be considered as 3 matrices, BLUE,RED and GREEN with integer values ranges from 0 to 255.

How BGR image is formed In the above image, each small box represents a pixel of the image. In real images, these pixels are so small that human eye cannot differentiate.

Usually, one can think that BGR color space is more suitable for color based segmentation. But HSV color space is the most suitable color space for color based image segmentation. So, in the above application, I have converted the color space of original image of the video from BGR to HSV image.

HSV color space is consists of 3 matrices, 'hue', 'saturation' and 'value'. In OpenCV, value range for 'hue', 'saturation' and 'value' are respectively 0-179, 0-255 and 0-255. 'Hue' represents the color, 'saturation' represents the amount to which that respective color is mixed with white and 'value' represents the amount to which that respective color is mixed with black.

Share Improve this answer Follow answered Jun 12, 2013 at 10:34 GPPK's user avatar GPPKGPPK 6,6465 gold badges35 silver badges59 bronze badges Add a comment | 10

According to http://en.wikipedia.org/wiki/HSL_and_HSV#Use_in_image_analysis :

Because the R, G, and B components of an object’s color in a digital image are all correlated with the amount of light hitting the object, and therefore with each other, image descriptions in terms of those components make object discrimination difficult. Descriptions in terms of hue/lightness/chroma or hue/lightness/saturation are often more relevant.

Also some good info here

Share Improve this answer Follow answered Jun 12, 2013 at 10:31 Intermernet's user avatar IntermernetIntermernet 19.3k4 gold badges50 silver badges61 bronze badges Add a comment | 5

The HSV color space abstracts color (hue) by separating it from saturation and pseudo-illumination. This makes it practical for real-world applications such as the one you have provided.

Share Improve this answer Follow answered Jun 12, 2013 at 10:35 Boyko Perfanov's user avatar Boyko PerfanovBoyko Perfanov 3,04720 silver badges35 bronze badges Add a comment | 3

R, G, B in RGB are all co-related to the color luminance( what we loosely call intensity),i.e., We cannot separate color information from luminance. HSV or Hue Saturation Value is used to separate image luminance from color information. This makes it easier when we are working on or need luminance of the image/frame. HSV also used in situations where color description plays an integral role.

Cheers

Share Improve this answer Follow answered Jun 19, 2017 at 6:59 0AJ0's user avatar 0AJ00AJ0 881 gold badge3 silver badges10 bronze badges Add a comment |

Your Answer

Reminder: Answers generated by artificial intelligence tools are not allowed on Stack Overflow. Learn more

Thanks for contributing an answer to Stack Overflow!

  • 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.

To learn more, see our tips on writing great answers.

Draft saved Draft discarded

Sign up or log in

Sign up using Google Sign up using Email and Password Submit

Post as a guest

Name Email

Required, but never shown

Post Your Answer Discard

By 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
  • We'll Be In Touch - A New Podcast From Stack Overflow!
  • The app that fights for your data privacy rights
  • Featured on Meta
  • More network sites to see advertising test
  • We’re (finally!) going to the cloud!
  • Call for testers for an early access release of a Stack Overflow extension...
10 OpenCV image conversion from RGB to HSV 81 Why OpenCV Using BGR Colour Space Instead of RGB 0 Full range of Hues: HSV to RGB color conversion for OpenCV 5 Should I use HSV/HSB or RGB and why? 0 MATLAB rgb2hsv() vs. OpenCV cvtColor() 0 OpenCV - RGB to HSV and back to RGB? 1 OpenCV Java RGB or HSV? 1 RGB to HSV in numpy 0 RGB to HSV is same as BGR to HSV? 2 Increasing the speed of the color space conversion algorithm from HSV to RGB

Hot Network Questions

  • How to protect against fake gold bars?
  • Stable points in GIT: geometric picture
  • Quantum gravity and perturbative parameters
  • Bleeding radiators
  • Is partial correctness decidable?
  • Is my evaluation for this multiple linear regression correct?
  • Is it legal to take advantage of loopholes in GAAP to misrepresent profit?
  • Did Superdana manufacture a 66 AC outlet power strip/surge protector?
  • Testing Puzzles for Puzzle Book: Enigmatic Puzzle
  • Nest "For Each" loops in Geometry Nodes
  • User temp folder is 103GB; is it safe to delete?
  • Do switches try to keep track of Ethernet group membership?
  • Get number of pixels in raster layer with valid data
  • Commencement and repeal dates in UK Acts of Parliament - meaning of "From and after"
  • How to install Raspberry Pi OS without using Imager?
  • Scandinavian film, 1980s, possibly called Royal Toilet?
  • Can we use the simple present tense to express a habit that starts just about 24 hours or less ago?
  • Dantzig-Wolfe Decomposition for nurse Scheduling problem
  • Biasing common-source NMOS with active load and fixed Vgs
  • What is it called when you have a hobby where you're good enough at to impress others but you yourself know you're only beginning?
  • C# basic calculator
  • Listing declined invitation to conferences in CV (because of agenda clash)
  • Boy who can see EM waves but loses the ability because of a thunderstorm
  • How to detect if the KERNAL load/save routine is currently active on a CBM system?
more hot questions Question feed Subscribe to RSS Question feed

To subscribe to this RSS feed, copy and paste this URL into your RSS reader.

Từ khóa » Hsv Color Space Advantages