Ask Your Question

Revision history [back]

You should have a look at the HSV-colorspace (use cv:cvtColor to convert from RGB to HSV). In this space, only the Hue-Channel contains the information on the color, whereas in RGB you need all three values. HSV is also much more resistent against a change of color then RGB. You should also allow a range of colors and not only compare via ==. cv::inrange would be the keyword here.

As a start, you could convert to HSV, get the Hue-values along your horizontal scan line and plot them as graph.

You should have a look at the HSV-colorspace (use cv:cvtColor to convert from RGB to HSV). In this space, only the Hue-Channel contains the information on the color, whereas in RGB you need all three values. HSV is also much more resistent against a change of color light then RGB. You should also allow a range of colors and not only compare via ==. cv::inrange would be the keyword here.

As a start, you could convert to HSV, get the Hue-values along your horizontal scan line and plot them as graph.

You should have a look at the HSV-colorspace (use cv:cvtColor to convert from RGB to HSV). In this space, only the Hue-Channel contains the information on the color, whereas in RGB you need all three values. HSV is also much more resistent against a change of light then than RGB. You should also allow a range of colors and not only compare via ==. cv::inrange would be the keyword here.

As a start, you could convert to HSV, get the Hue-values along your horizontal scan line and plot them as graph.