Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

line segments from same line showing different angles

Hi,

I am using HoughLinesP to calculate lines from image. But the line segments from same line have different angles.

image description

the segments start and end points and angle (in degrees) and length.

id = 0 start(x,y) = (1331 , 790 )   end(x,y) = (1366 , 794 ) Angle = 6.52311 len = 35.2278
id = 2 start(x,y) = (1508 , 807 )   end(x,y) = (1543 , 810 ) Angle = 4.90158 len = 35.1283
id = 4 start(x,y) = (1291 , 786 )   end(x,y) = (1328 , 789 ) Angle = 4.63781 len = 37.1214
id = 8 start(x,y) = (1391 , 795 )   end(x,y) = (1423 , 798 ) Angle = 5.35854 len = 32.1403
id = 9 start(x,y) = (1224 , 779 )   end(x,y) = (1261 , 782 ) Angle = 4.63781 len = 37.1214

To calculate angle i used atan2(y2-y1,x2-x1)*180/3.14

I am expecting same angle since the segments are part of same line.

Is there a way to improve the angle calculation or improving line detection ?

thanks.