OpenCV - How to determine whether a given point is within a contour?
问题 Given a random contour, how can I say if a given input point lies within the contour or not? I am sorry if it has a simple solution, but I am unable to figure it out. One idea I had was to use equation of lines, connect points and see if it is greater or smaller, etc. But that doesn't get me anywhere, as it depends on the position of line. 回答1: You can find a full solution to this problem using OpenCV here /// Get the contours vector<vector<Point> > contours; vector<Vec4i> hierarchy; Mat src