openCV没有匹配的函数fillPoly [英] openCV no matching function fillPoly
本文介绍了openCV没有匹配的函数fillPoly的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试实现此答案,但我总是遇到错误.请帮忙.
I am trying to implement this answer, but I am getting always error. Please help.
我的代码:
cv::Point corners[1][6];
for (unsigned long j = startIndex; j < startIndex+6; j++) {
int x = shape.part(j).x();
int y = shape.part(j).y();
corners[0][j-startIndex] = Point(x, y);
}
const Point* corner_list[1] = {corners[0]};
cv::Mat mask(image.rows, image.cols, CV_8UC2);
cv::fillPoly(mask, corner_list, 6, 1, cv::Scalar(255), 8);
cv::Mat result(image.size(), image.type(), cv::Scalar(0,0,0));
image.copyTo(result, mask);
这是我的错误:
jni/jni_detections/jni_face_det.cpp:121:5: error: no matching function for call to 'fillPoly'
cv::fillPoly( mask, corner_list, num_points, num_polygons, cv::Scalar( 255, 255, 255 ), line_type);
^~~~~~~~~~~~
/home/feli/Development/android/test/dlib/dlib-android/third_party/opencv/jni/include/opencv2/imgproc.hpp:3987:17: note:
candidate function not viable: no known conversion from 'int' to 'const int *' for 3rd argument; take the address of
the argument with & CV_EXPORTS void fillPoly(Mat& img, const Point** pts,
^
/home/feli/Development/android/test/dlib/dlib-android/third_party/opencv/jni/include/opencv2/imgproc.hpp:4005:19: note:
candidate function not viable: no known conversion from 'const Point *[1]' to 'const cv::_InputArray' for 2nd argument
CV_EXPORTS_W void fillPoly(InputOutputArray img, InputArrayOfArrays pts,
^
我的OpenCV版本是3.1.0
My OpenCV version is 3.1.0
推荐答案
我需要像这样传递numPoints参数的指针:
I needed to pass the numPoints parameter's pointer like this:
int num_points = 6;
cv::fillPoly(mask, corner_list, &num_points, 1, cv::Scalar(255), 8);
感谢@Tim Sweet
Thanks @Tim Sweet
这篇关于openCV没有匹配的函数fillPoly的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文