在EmguCV中检测到的线角度 [英] Detected Lines Angle in EmguCV

查看:259
本文介绍了在EmguCV中检测到的线角度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用image.HoughLine在我的图像中找到线.我想知道每条线的角度.所以我尝试了:

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;

但是,它返回0和-1,而图像中的线至少具有15度. (我自己旋转了图片).

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

怎么了? LineSegment2D类中的Direction是什么,对您有帮助吗?

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

推荐答案

我找到了解决方案. 你知道是什么问题吗?很简单, Math.Atan2函数以弧度为单位返回结果,所以我将其转换为度数并猜测是什么?一切都解决了;)

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 ;)

顺便说一句,我仍然不知道LineSegment2D类中的Direction和Length是什么,Emgu文档没有帮助我找到任何线索.

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.

这篇关于在EmguCV中检测到的线角度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆