Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

There is no function to extend a line in OpenCV. Fortunately this is a simple geometry problem.

The formula for your line is:

P = points[0]+i*(points[1]-points[0])

where i in [0...1]. To draw a line just make a loop and set every P to a desired color.

To extend a line beyond the endpoints, just increase the range of i. Negative values will extend beyond point[0], values greater than 1 beyond point[1].