I am doing a convexhull of a contour if it is not convex in a function:
PointVector Verification::convexingContour(const PointVector& contourIn)
{
PointVector hullRet;
if (cv::isContourConvex(contourIn))
{
return contourIn;
}
else
{
cv::convexHull(contourIn, hullRet);
return hullRet;
}
}
I get the error of:
OpenCV Error: Assertion failed (contour.checkVector(2) >= 0 && (contour.depth() == CV_32F || contour.depth() == CV_32S)) in isContourConvex, file /home/me/opencv/modules/imgproc/src/contours.cpp, line 2010
unknown location(0): fatal error in "sol2": std::exception: /home/me/opencv/modules/imgproc/src/contours.cpp:2010: error: (-215) contour.checkVector(2) >= 0 && (contour.depth() == CV_32F || contour.depth() == CV_32S) in function isContourConvex
at runtime. The problem appears just for some contours, because I run the function on a set of images. What could be the problem? Is there a bug, because I have seen the same problem on VS2012, reported as problem?