How to use the output of cv2.fitLine() [closed]

asked 2018-04-02 23:14:07 -0500

abhijit gravatar image

I am basically trying to fit 2 lines to 2 sets of points (each has 100 points) and find the normal distance between the lines, I am using cv2.fitLine() to fit the line in python

From the documentation, fitLine returns a vector containing: (vx, vy, x0, y0), Where vx,vy are normalized vector collinear to the line and x0,y0 is a point on the line. I am confused on how to get the equation of the line from these values so that I can find the normal distance between the two lines.

edit retag flag offensive reopen merge delete

Closed for the following reason question is off-topic or not relevant by berak
close date 2018-04-03 01:00:47.512610



not at all an opencv problem, but a plain maths one.

(and maybe your expectation is somewhat wrong here)

in 2d it only makes sense, if your lines are parallel (else they meet at some point, and the distance is 0) non-parallel lines also cannot have a normal shared by both lines.

in 3d it's a skew lines problem

berak gravatar imageberak ( 2018-04-03 00:57:11 -0500 )edit