13

I'm developing an App in which children need to find certain colors using a certain target dot on the camera screen - kind of augmented reality like. I've got the whole thing working already, but with RGB colors. For each color, red, green, blue, yellow, purple, etc. I've been testing and defining the ranges of the RGB values to determine when it is exactly which color. A lot of work.

However, I've learned that using HSV it works even better. But I don't want to go through the whole process again of setting ranges for each color. But I simply can't find it anywhere online, I've been googling for two hours already!

So what I'm searching for is pretty simple: For a set of about 8 standard colors: red, green, blue, yellow, purple, etc the corresponding HSV ranges.

For example: The color red - Hue between 0 and 20, Saturation between 0.8 and 1.0, Value between 0.8 and 1.0. (not sure this is right, just an example)

I mean, someone must have done this already sometime!?

3
  • I'm not sure what you need in the ranges, but if you just need to convert between RGB and HSV, the functions in this question should do the trick: stackoverflow.com/questions/5589804/… Commented Sep 10, 2012 at 22:19
  • Hi Brad, thanks but I've got the conversion already. I need ranges of some standard colors, like in the example in my post Commented Sep 10, 2012 at 22:43
  • If you know the colour ranges in RGB then produce some sample data of each color in RGB, convert each one to HSV and look at the spread of new values. Then you will have your range. Once you do this for one colour you can automate the process for every other colour.
    – Arijoon
    Commented Sep 3, 2014 at 14:58

1 Answer 1

13

One of the first mathematically defined color spaces is the CIE 1931 XYZ color space. I think that article on Wikipedia should provide some additional insight in the complexity of what you would like to do. I am sure that someone has done this, but I don't believe it's open source.

The closest chart I found is publish on Wikipedia under Web colors article. CSS 1–2.0 / HTML 3.2–4 / VGA color names

2
  • Thanks that did help me! Sorry for the late answer-tick :) Commented Sep 20, 2012 at 7:30
  • 1
    Would the HSV ranges remain the same for using openCV?
    – Sohaib
    Commented Oct 6, 2013 at 15:26

Your Answer

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.