Im detecting the HUE color using the following code:
Mother img_hsv, dst;
cap → image;
cvtColor (image, img_hsv, CV_RGB2HSV);
inRange (img_hsv, Scalar (110, 130, 100), Scalar (140, 255, 255), dst);
where dst is a Mat of the same size as img_hsv and CV_8U.
And your scalars define the filtered color. In my case, this is:
HUE 110 to 140
SAT 130 to 255
VAL 100 to 255
more information here: OpenCV 2.4 InRange ()
I'm not sure about using a shade that overflows the 180 range, but I think you can calculate them separately and then add the resulting mats.
source share