Search code examples
c#opencvdetectemgucv

How do I use Emgu CV to detect arrows in an image?


I am doing some basic image processing to detect polygons and a bit of OCR to process a flow chart drawn on white boards using Emgu CV on C#.

But now, I am facing difficulties detecting arrows (straight lines with a pointed < or >) in any direction. I am wondering if anyone is aware of a method that I can use to detect arrows and their pointing end. From then, I can find nearby objects and go ahead with more processing.

I would greatly appreciate any suggestions anyone might have.

Thank you!


Solution

  • There are many methods to do object recognition. In order to know which one to choose, you should have the following information : can my objects (arrows) have different shapes (width, height,...) ? The shape is fixed but my object can have rotation, translation and scale ? What are the others objects ?

    For detecting arrows, you can use findContours and then use different features to discriminate the contour of arrow such as perimeter, area, density, minAreaRect... You can also polygonize the contour and observe the parameters of every segment, compute the angle between segment... (maybe it is a little too complicated for your case).

    You can find the orientation of a shape by using PCA, it will work very well on arrows. Then, in order to find the ending point, you will just have to analyze the right and left part of the object.

    For detecting lines you can also use Hough but if you are not familiar with it, you will need some time to play with the thresholds before having the results you want.