Unhandled exception in Contour.exe
Hello,
My code in OpenCV works well up until when I want to find contours:
findContours(src, contours,hierarchy, CV_RETR_TREE, CV_CHAIN_APPROX_SIMPLE);
then I keep getting the following error:
"Unhandled exception at 0x773e3e28 in Contour.exe: Microsoft C++ exception: cv::Exception at memory location 0x002ff3ac.."
Do you have any idea about this error?
My full code is below.
Thanks
Mat src=Mat(100,200,CV_64F),newimg;
vector<vector<Point>> contours;
vector<Vec4i> hierarchy;
for (int i=25;i<80;i++)
for(int j=25;j<80;j++)
src.at<double>(i,j)=1;
imshow("img",src);
waitKey(0);
findContours(src, contours,hierarchy, CV_RETR_TREE, CV_CHAIN_APPROX_SIMPLE);
OpenCV Error: Unsupported format or combination of formats [Start]FindContours supports only CV_8UC1 images when mode != CV_RETR_FLOODFILL otherwise supports CV_32SC1 images only in function cvStartFindContours
Why not replacing the for loops by
src(cv::Rect(25, 25, 55, 55)).setTo(1);
?again, only CV_8U input is valid for findContours()