pointPolygonTest in OpenCV 2.2
- by Mathieu Dubois
I wanted to use pointPolygonTest but I have a problem.
I'm stuck to OpenCV2.2.
I tried to use the code found here: http://docs.opencv.org/doc/tutorials/imgproc/shapedescriptors/point_polygon_test/point_polygon_test.html#point-polygon-test
I use findContours to detect contours in an image. Under OpenCV 2.2 returns a vector< vector<Point> >.
The problem is that pointPolygonTest accept a matrix as an entry. Therefore the code doesn't compile with OpenCV 2.2:
erreur: invalid initialization of reference of type ‘const cv::Mat&’ from expression of type ‘std::vector<cv::Point_<int>, std::allocator<cv::Point_<int> > >’
Under more recent OpenCV versions, the findContours function returns vector<Mat> so it's easy to pass to pointPolygonTest (see the example).
I guess I could convert the vector< vector<Point> > to vector<Mat>.
Unfortunately the documentation is not very clear about the format.
Does anybody have an advice?