Detected Lines Angle in EmguCV

限于喜欢 提交于 2019-12-11 06:07:00

问题


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 ?


回答1:


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.



来源:https://stackoverflow.com/questions/3175203/detected-lines-angle-in-emgucv

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!