我在OpenCV中的代码运行良好,直到我想找到轮廓:
findContours(src, contours,hierarchy, CV_RETR_TREE, CV_CHAIN_APPROX_SIMPLE);
然后我不断收到以下错误:
“Contour.exe 中 0x773e3e28 处未处理的异常:Microsoft C++ 异常:cv::Exception at memory location 0x002ff3ac..”
您对此错误有任何想法吗?
我的完整代码如下。
谢谢
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);