OpenCV 2.4.8(Python)确定箭头的方向 [英] OpenCV 2.4.8 (Python) Determining Orientation of an Arrow

查看:950
本文介绍了OpenCV 2.4.8(Python)确定箭头的方向的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在从事一个需要确定箭头方向的项目.这些箭头将用作机器人确定其行进方向的输入.

I am currently working on a project where I need to determine the orientation of arrows. These arrows will be used as input for a robot to determine what direction it should travel in.

我正在将Beaglebone Black与Ubuntu和OpenCV 2.4.8一起使用.我正在尝试使用SURF,ORB,SIFT,Moments和BFMatcher.我还没有找到确定箭头方向的可靠方法.这需要实时完成,因为我们将使用视频中的帧.

I am using a Beaglebone Black with Ubuntu and OpenCV 2.4.8. I've experimenting with SURF, ORB, SIFT, Moments, and BFMatcher. I haven't found a reliable way to determine the orientation of an arrow. This needs to be done in real time as we will be using frames from a video.

我想知道是否有人可以提供可靠的解决方案来确定箭头的方向?

I was wondering if someone could offer a reliable solution to determine the orientation of an arrow?

这是示例图片:

推荐答案

这里有一些方法,我认为它可以与您提供的图像一起使用.

Here is some approach, I think it will works with the image you provided.

由于您的箭头图像的每个角都具有以下角度,如下图所示,因此您始终可以将箭头尖端视为角接近90度的角以及相邻角的角度接近45度的角.

As your arrow image have the following angle for each corner as shown in the below image, you can always consider arrow tip as the corner which have angle close to 90 degree, as well as adjacent corner with angle close to 45 degree.

即找出箭头尖端,计算出构成箭头指针的相邻线的角度,并将该角度相加,即您的箭头方向.

That is find out the arrow tip, calculate angle for adjacent line which making the arrow pointer, and add up the angle, which will be your arrow direction.

所以尝试

  1. 找到轮廓和大约Poly .

查找每条线的角度以及转角(相邻线之间的角度).

Find angle for each line as well as the corner(angle between adjacent line).

使用以上拐角条件搜索箭头的尖端.

Search for the tip of arrow using above criteria for corner.

现在您获得了箭头指针和相邻的线(具有角度),将这两条线的结果作为方向,即将角度相加.

Now you got the arrow pointer and adjacent line(with angle), take the resultant of these two lines as your direction, that is just add up the angle.

也请参见链接.

这篇关于OpenCV 2.4.8(Python)确定箭头的方向的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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