fillPoly crashes
I have called
std::vector< cv::Point > contour = contourIn; // initialization with input contour
cv::Mat maskC(cv::Size(680, 480), CV_8UC1, cv::Scalar::all(0));
cv::fillPoly(mask, contour, cv::Scalar::all(255));
fillPoly
is crashing saying:
OpenCV Error: Assertion failed (i < 0) in getMat, file /home/stefan/git_repos/opencv/modules/core/src/matrix.cpp, line 963
Before I was having the same code, but I was calling the fillConvexPoly
instead of fillPoly
:
cv::Mat maskC(cv::Size(680, 480), CV_8UC1, cv::Scalar::all(0));
std::vector< cv::Point > contourCvx = convexingContour(contourIn); // initialization with the convex hull of the input contour
cv::fillConvexPoly(maskC, contourCvx, cv::Scalar::all(255));
I am using this to create a mask of the contours interior. I have changed to fillPoly
because the input contour is not always convex.
Please help.