# 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?

( 2016-12-15 15:09:30 -0500 )edit

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)

( 2015-01-14 02:45:39 -0500 )edit

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

( 2015-01-14 14:37:14 -0500 )edit

Official site

GitHub

Wiki

Documentation