Hi guys,
I am trying to figure out how much an arrow is rotated in an image.
this is the arrow
there’s one contain the rotated arrow
I can locate the arrow by using template matching.
however, I would like to know how much the arrow is rotated.
if the arrow is pointing to the north, the rotation is 0 degree.
if the arrow is pointing to the south, the rotation is pi(180) degree
if the arrow is pointing to the east, the rotation is pi/2 (90) degree
if the arrow is pointint to the west, the rotation is 3/2 pi (270) degree.
the arrow can pointing at any direction apart from the four directions i mentioned.
I am a new starter of open cv. I need a bit of guidance to point me to the right direction.
I’ve tried template matching, scaled template matching I can get the location of the arrow even it’s rotated in the picture but i am not sure how to get the rotation
please note the image contains the rotated arrow can be high resolution and low resolution depends on the set up. the image i posted is very low setup.
here’s the bit of code i use to locate the template(arrow) - i use a c# wrapper of open cv but i believe you should understand what i am doing here.
CvInvoke.MatchTemplate(imgScene, template, imgout, Emgu.CV.CvEnum.TemplateMatchingType.CcorrNormed);
double minVal = 0.0;
double maxVal = 0.0;
Point minLoc = new Point();
Point maxLoc = new Point();
CvInvoke.MinMaxLoc(imgout, ref minVal, ref maxVal, ref minLoc, ref maxLoc);
Rectangle r = new Rectangle(maxLoc, template.Size);
CvInvoke.Rectangle(imgScene, r, new MCvScalar(0,255,0));
thanks very much in advance.
P