Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

findContours detects contours in binary image. So it checks which pixels of image are equal to zero, and which pixels are not. Natural image like the one you provided most likely don't have any pixels that equal to zero. So you have to turn it into binary image. For example you can threshold the image like Daniil suggested. A naive way to do so:

Mat binaryImage = (image > mean(image));
findContours( binaryImage, contours, CV_RETR_LIST, CV_CHAIN_APPROX_SIMPLE);