So basically I got game(GTA V) that is running live on my pc, in GTA you got minimap with arrows pointing on the direction you need to turn. I want to get a comparison between left, right, straight and backward arrow templates to get the most similar arrow to the arrow I'm getting live from the game. So my question is how can compare this level of similarity between 2 images.
Asked
Active
Viewed 944 times
-1
-
See structural similarity index (ssim) at https://www.pyimagesearch.com/2014/09/15/python-compare-two-images/ – fmw42 Feb 07 '20 at 17:56
1 Answers
0
One approach can be made with template matching, are you have two examples: OpenCV template matching Scikit-image template matching.
This would be the pipeline that I would follow, first get a template (and image like those you posted) for each of the directions left, right, straight and backward.
Then use a template matching algorithm for each of the four templates over the arrow that you want to recognize, and get the direction from the template that gets more similarity.
Another approach can be made by shape detection PyImageSearch - shape detection but I guess you are not planning only to detect these directions and the first approach could be easily applied to other detections.
An over-killing way may be to train a CNN.
-
I'm looking for the fastest way, I thought maybe recognize triangle and then try to understand the direction with the position of the triangle in my image. I just need to get the direction of the arrow. – מקס גופמן Feb 07 '20 at 18:51
-
Then you could check the vertex of the arrow to know the direction. you can find how to do the vertex detection here [how to find corners on a image](https://stackoverflow.com/questions/7263621/how-to-find-corners-on-a-image-using-opencv) – Daniel Anton Feb 08 '20 at 12:24
-
So then I should find the only point which is not at the almost same line with any other point(vertically and horizontally) if it is on the right half it is a right arrow, left half - left arrow, upper half - straight arrow, and lower half-backward arrow? – מקס גופמן Feb 08 '20 at 13:08