If cvFitLine() returns the normalized vector (vx,vy) and point (x0,y0) , then the equation of the line
(x, y) = (x0, y0) + t * (vx, vy)
where t runs from & minus; & infin; to + & infin ;.
This is what you asked for, but probably doesn’t immediately help in drawing the line. You would like to copy it either to the borders of the screen, or, possibly, to the bounding box of the original set of points. To copy a line into a rectangle, just solve for the t values where the line intersects the border of the rectangle.
brainjam
source share