开发者

Detected Lines Angle in EmguCV

i used image.HoughLine to find line in my image. i want to know the angle of each line. so i tried :

double deltaY = line.P2.Y 开发者_开发技巧- line.P1.Y;
double deltaX = line.P2.X - line.P1.X;
double angle;
if (deltaX != 0)
        angle = Math.Atan2(deltaY, deltaX);
else
        angle = 90;

but , it returns 0 and -1 , while the lines in image at least have 15 degree . ( i rotated the image myself ).

what's wrong? and what is Direction in LineSegment2D class, could it help ?


I Found myself the solution. you know what was the problem ? so simple, The Math.Atan2 function return the result in radian unit , so i converted it to degree and guess what? everything solved ;)

BTW, I still don't know what is the Direction and Length in LineSegment2D class, Emgu documentation didn't help me to find any clue.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜