OpenCV most efficient way to find a point in a polygon

asked 2015-10-26 05:31:44 -0500

cylix gravatar image

I have a dataset of 500 cv::Point.

For each point, I need to determine if this point is contained in a ROI modelized by a concave polygon. This polygon can be quite large (most of the time, it can be contained in a bounding box of 100x400, but it can be larger)

For that number of points and that size of polygon, what is the most efficient way to determine if a point is in a polygon?

using the pointPolygonTest openCV function? building a mask with drawContours and finding if the point is white or black in the mask? other solution? (I really want to be accurate, so convex polygons and bounding boxes are excluded).

edit retag flag offensive close merge delete

Comments

2

I think pointPolygonTest will make the job ;-)

theodore gravatar imagetheodore ( 2015-10-26 06:08:43 -0500 )edit