Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

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);