Ask Your Question

Revision history [back]

How to specifically know the HSV value of an object from webcam

m working on a project that need HSV color threshold for color segmentation. i find the threshold using this function

IplImage* GetThresholdedImage(IplImage* imgHSV){       
    IplImage* imgThresh=cvCreateImage(cvGetSize(imgHSV),IPL_DEPTH_8U, 1);
    cvInRangeS(imgHSV, cvScalar(170,160,60), cvScalar(180,2556,256), imgThresh); 
    return imgThresh;
}

my problem is the color is often not detected when i run the project in the morning, noon or night. And i have to find the range manually and input it again in my code which is tiresome.

Is there any way to automatically find the color threshold of my object. Lets say i need to find red object.

Thank you for your attention. i waited for any of your response