I have drawn a rectangle using cv.rectangle and have a contours shape (from FindContours) which the rectangle is drawn over .
The rectangle intersects the the complete contour at two points. How can I find these points of intersection between the rectangle and the contour outline.
I could add the two images together and look for maxima but I do know how the rectangle vertices are stored , as I would need a line type vector filled with a set of points
Thanks
If you are sure that your rectangle cross the shape at only 2 points, you can iterate through your contour point, and check if these points are in your rectangle border.