Ask Your Question

Revision history [back]

You can approximate you object (contour) to a convex hull or find its bounding rectangle. This way, checking the position relative to the line will much much simplified. E.g. finding the intersections with the bounding lines from the approximation.

Here you can find a tutorial on how to draw lines. It is done by calling the line function, supplying an image, where the line will be draw, starting position, end, colour (you can use CV_RGB(red_value, green_value, blue_value)), thickness.