How to isolate a single color in an image
-
13-09-2019 - |
Question
I'm using the python OpenCV bindings and at the moment I try to isolate a colorrange. That means I want to filter out everything that is not reddish.
I tried to take only the red color channel but this includes the white spaces in the Image too.
What is a good way to do that?
Solution
Use a different color space: http://en.wikipedia.org/wiki/HSL_color_space
OTHER TIPS
Use the HSV colorspace. Select pixels that have an H value in the range that you consider to contain "red," and an S value large enough that you do not consider it to be neutral, maroon, brown, or pink. You might also need to throw out pixels with low V's. The H dimension is a circle, and red is right where the circle is split, so your H range will be in two parts, one near 255, the other near 0.
How about using a formular like r' = r-(g+b)?