Sorry, this content is no longer available

Ask Your Question
1

lines parallel with houghlines opencv+python

asked Jan 13 '15

GUI gravatar image

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?

Preview: (hide)

Comments

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

noiro gravatar imagenoiro (Dec 15 '16)edit

1 answer

Sort by » oldest newest most voted
1

answered Jan 13 '15

Haris gravatar image

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.

Preview: (hide)

Comments

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)

StevenPuttemans gravatar imageStevenPuttemans (Jan 14 '15)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

GUI gravatar imageGUI (Jan 14 '15)edit

Question Tools

1 follower

Stats

Asked: Jan 13 '15

Seen: 4,623 times

Last updated: Jan 13 '15