【发布时间】:2013-04-09 17:22:53
【问题描述】:
我正在尝试从以下代码中获取凸面缺陷,但不断收到未处理的异常。 我做错了什么?
vector<Vec4i> defects;
ContourPoly = vector<Point>(contour.size());
approxPolyDP( Mat(contour), ContourPoly,20, false );
convexHull(Mat(ContourPoly), HullPoints, false, true);
// The following line wont work
convexityDefects(Mat(ContourPoly),HullPoints,defects);
虽然 HullPoints 的类型是 vector<Point>
异常如下
OpenCV Error: Assertion Failed (ptnum >3) is unknown function, file ..\..\..\src\opencv\modules\imgproc\src\contours.cpp, line 1969
但是使用vector<Point> defects; 或vector<Vec4i> defects
我得到以下异常
OpenCV Error: Assertion Failed (hull.checkVector(1,CV_32S) is unknown function, file ..\..\..\src\opencv\modules\imgproc\src\contours.cpp, line 1971
【问题讨论】:
-
以下哪个原因会触发异常?你的调试说明了什么?
-
我刚刚添加了一个例外
-
ptnum >3断言意味着您的HullPoints包含少于convexityDefects所需的最少3 个点 -
不走运,我又试了一次,现在它给了我上面提到的第二个错误\
标签: visual-c++ opencv convexity-defects