0

I am trying to identify pokémon. At first I thought about image-recognition, but then I realized it wasn't necessary since I could compare the screenshot of a pokémon with the actual sprites of the game (which are almost identical).

Pokémon Sprite

Screenshot Pokémon

I searched on this community on how to check if two images look the same and I came across this question: Programmatically determine if 2 images look the same using Java.

I've tried the code posted in the accepted answer but sadly didn't work for me because even though the two images are almost identical the result stated otherwise.

butexa
  • 165
  • 8
  • What the other answer concerns about is how 'different' two images are, not if one image is contained (with offset) in another. What you need is a more sophisticated CV approach. – Mark Jeronimus Apr 26 '19 at 14:08
  • @MarkJeronimus I see, but sadly I have no idea where to start since I have zero experience when it comes to this matter. – butexa Apr 26 '19 at 14:18
  • You can start by iterating over all possible offsets (locations), calculating a matching score. Then you should find one offset with the smallest score. Then you can can try to optimize by for speed by using bigger offset steps in the beginning and zeroing in on the best location (divide & conquer). Watch out for local minima. It's called template matching. It often helps me to make a visual representation of all matching scores overlayed on the original image, using gray scales for the scores – Mark Jeronimus Apr 26 '19 at 15:20
  • https://docs.opencv.org/3.4.3/d4/dc6/tutorial_py_template_matching.html may give you some inspiration (e.g. using the sum-of-squares (what they call TM_SQDIFF) instead of naive sum-of-differences may yield better results) – Mark Jeronimus Apr 26 '19 at 15:30
  • Thank you! I opened a new question here: https://stackoverflow.com/questions/55874337/opencv-always-matching-template – butexa Apr 26 '19 at 20:42

0 Answers0