C ++中的OpenCV fillConvexPoly函数抛出异常

时间:2016-10-27 12:16:50

标签: c++ opencv

我尝试使用fillConvexPoly函数填充蒙版中的三角形。 但是我收到以下错误。

OpenCV Error: Assertion failed (points.checkVector(2, CV_32S) >= 0) in fillConvexPoly, file /home/iris/Downloads/opencv-3.1.0/modules/imgproc/src/drawing.cpp, line 2256
terminate called after throwing an instance of 'cv::Exception'
 what():  /home/iris/Downloads/opencv-3.1.0/modules/imgproc/src/drawing.cpp:2256: error: (-215) points.checkVector(2, CV_32S) >= 0 in function fillConvexPoly

我像这样调用函数,

cv::Mat mask = cv::Mat::zeros(r2.size(), CV_32FC3);
cv::fillConvexPoly(mask, trOutCroppedInt, cv::Scalar(1.0, 1.0, 1.0), 16, 0);

其中trOutCroppedInt定义如此,

std::vector<cv::Point> trOutCroppedInt

我在矢量中推了3个点,

[83, 46; 0, 48; 39, 0]

我该如何更正此错误?

0 个答案:

没有答案