Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

There is fantastic tracking example (extracted into your samples directory when you installed opencv) called objecttracking. 1) it converts to image from RGB to HSV - cvtColor(imageRGB,imageHSV,COLOR_BGR2HSV); 2) it extracts all sections that match the required HSV requirement - in your case intensity only inRange(imageHSV,Scalar(H_MIN,S_MIN,V_MIN),Scalar(H_MAX,S_MAX,V_MAX),imagethreshold); 3) It uses a morphological function (erode and dilate) to clean the image of 'noise' 4) It then uses find contours to create rectangles around all parts of the image that match your threshold (findContours(imagetemp,contours,hierarchy,CV_RETR_EXTERNAL,CV_CHAIN_APPROX_SIMPLE );

Hope I understood your question....