6

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.

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 a sample image:

grg
  • 5,023
  • 3
  • 34
  • 50
Knoose
  • 113
  • 4
  • 11

1 Answers1

10

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

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.

enter image description here

So try with

  1. Find contour and approxPolyDP.

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

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

  4. 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.

Also see this link might be helpful.

Community
  • 1
  • 1
Haris
  • 13,645
  • 12
  • 90
  • 121
  • So I'm using the image I posted above and I'm running the following program: http://i.imgur.com/0myNfap.png I got the following output: http://i.imgur.com/yxpqlz7.png I'm not sure of the best way to search for the tip of the arrow? – Knoose Apr 05 '14 at 20:29
  • @Knoose Make the value epsilon in approxPolyDP() higher until you get total number of points 7 as your arrow have 7 corners. – Haris Apr 06 '14 at 04:47
  • I ended up using cv2.goodFeaturesToTrack(). I had it find 7 points of interest on a cropped image of my arrow. It worked very well because the cropping of the image removed the lines of my 'road' and cv2.goodFeaturesToTrack() got the points I needed. I also ended up creating my own algorithm for detecting the direction and it works very reliably. Thanks for the help! – Knoose Apr 08 '14 at 16:12
  • This really helped me too! Thanks – Ivantha Aug 16 '16 at 06:21
  • I did almost the exact same thing for a university project. Through a lot of trial and error I eventually arrived at a very similar approach. https://github.com/NewDevices/football_project in case anybody is interested. Look for `object_finder.py` and the `find_arrow` method. – Hendrikto May 06 '17 at 15:09