views:

340

answers:

3

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?

+4  A: 

Use a different color space: http://en.wikipedia.org/wiki/HSL_color_space

Dave
A: 

How about using a formular like r' = r-(g+b)?

Niki
PS: You can try any function on colors that has a maximum at RGB=(255,0,0). E.g. 255-Euclidian Distance(rgb, Red), or Euclidian Distance in a HSV color space.
Niki
+1  A: 

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.

Jive Dadson