Trying to run findContours on a binary image”
Mat conv(image.size(), CV_8U);
image.convertTo(conv, CV_8U);
vector<vector<cv::Point> > contours;
findContours(conv, contours, CV_RETR_LIST, CV_CHAIN_APPROX_SIMPLE);
thorws error:
OpenCV Error: Unsupported format or combination of formats ([Start]FindContours support only 8uC1 images) in cvStartFindContours,
Any ideas?
Thanks
From the documentation:
You see that the number of channels is not changed by
convertTo, this means most probably that you get 3 channels (r, g and b). HoweverfindContoursrequires a monochrome image.You need to convert the image to black-and-white: