我想使用pointPolygonTest,但我有问题。我的 OpenCV 版本是 2.2。
我尝试使用本教程中的代码。
我findContours用来检测图像中的轮廓。在 OpenCV 2.2 下返回一个vector<vector<Point> >.
问题是pointPolygonTest接受 acv::Mat作为条目。因此代码不能用 OpenCV 2.2 编译:
error: invalid initialization of reference of type ‘const cv::Mat&’ from expression of type ‘std::vector<cv::Point_<int>, std::allocator<cv::Point_<int> > >’
在较新的 OpenCV 版本下,该findContours函数会返回vector<Mat>,因此很容易传递给它pointPolygonTest(参见示例)。
我想我可以vector< vector<Point> >将vector<Mat>. 不幸的是,文档对格式不是很清楚。
有人有建议吗?