detect yellow color in opencv

You should try this tutorial for "tracking yellow objects".

It gives a HSV range of cvInRangeS(imgHSV, cvScalar(20, 100, 100), cvScalar(30, 255, 255), imgThreshed) for yellow object.

If you have any doubt on selecting color, try this : http://www.yafla.com/yaflaColor/ColorRGBHSL.aspx


you can also convert RGB into HUE

http://en.wikipedia.org/wiki/Hue

in the link you have the formula, then you know that yellow has a HUE value around 60.


for yellow color the range as should be from 23 to 40 for example as per i am using in my yellow object tracking program

//Thresholding the frame for yellow

   cvInRangeS(hsvframe,cvScalar(23,41,133),cvScalar(40,150,255),threshy);