Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

detect yellow color in opencv

i convert image to HSV after it i make the threshold the yellow color so the code is cvInRangeS(imgHSV, cvScalar(112, 100, 100), cvScalar(124, 255, 255), imgThreshed); but it doesn't work always give me black image .

like image 386
Mohamed Kamal Avatar asked Feb 07 '12 15:02

Mohamed Kamal


People also ask

Can OpenCV detect colors?

OpenCV has some built-in functions to perform Color detection and Segmentation operations. So what are Color Detection and Segmentation Techniques in Image Processing? Color detection is a technique of detecting any color in a given range of HSV (hue saturation value) color space.

What color code does OpenCV use?

BGR color space: OpenCV's default color space is RGB. However, it actually stores color in the BGR format.

How do I find the color of an image in Python?

getcolors()" function in PIL which returns a {color,count}.


1 Answers

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

like image 132
Abid Rahman K Avatar answered Oct 08 '22 16:10

Abid Rahman K