Attention! This forum will be made read-only by Dec-20. Please migrate to https://forum.opencv.org. Most of existing active users should've received invitation by e-mail.

# lines parallel with houghlines opencv+python

I need to know how draw lines parallel, I'm beginning with Opencv, please help. I use the houghlines function for detect lines, now I want detect lines parallel, I know that the ecuacion of a lines is y = k*x+b and two lines are parallel when k1 = k2. but how represent this in opencv with houghlines?

edit retag close merge delete

Hi,you have found the answer to this question? if you find an answer you can share?

Sort by » oldest newest most voted In another way,

• Find the angle for each line using the equation

 double Angle = atan2(y2 - y1, x2 - x1) * 180.0 / CV_PI;

• Compare angles for all detected lines to separate parallel lines.

more

2

The comparison can be done by applying a K-means clustering on the resulting angles. As to the angles itself, x and y are two points on the line itself (for clarification)

if I use houghlinesP I can calculate m = (y2 - y1) / (x2 - x1) but I don't know how to compare between each item or pair of points (x1y1 and x2y2) of lines vector []. I trying with itertools.combination but I don't know how to do

Official site

GitHub

Wiki

Documentation