Unhandled exception in Contour.exe

asked 2015-09-13 19:22:19 -0600

mask2007 gravatar image

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);
edit retag flag offensive close merge delete

Comments

2

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

sturkmen gravatar imagesturkmen ( 2015-09-14 01:16:15 -0600 )edit
2

Why not replacing the for loops by src(cv::Rect(25, 25, 55, 55)).setTo(1); ?

thdrksdfthmn gravatar imagethdrksdfthmn ( 2015-09-14 02:19:25 -0600 )edit
1

again, only CV_8U input is valid for findContours()

berak gravatar imageberak ( 2015-09-14 02:49:43 -0600 )edit