Im trying to create a program that will identify a playing card using template matching. It will have template pictures of the rank and suit portion of the playing card which then will be compared to a picture taken by a raspberry camera. The issue I’m having is that cv2.matchTemplate will return the location of the template in the picture, but I want to match the template to all possible playing cards, and then determine which playing card (template image) is the best match with the picture taken by the raspberry.
Could someone help me, or point me in the right direction?
OpenCV’s “template matching” is a particular type of template matching. it will not work here. template matching can be taken more generally. stuff like the “chamfer distance transform” allows for variation in the appearance. that will also not help you.
your situation is usually approached with feature matching or contour finding.
The cards will always end up on the same place above the camera, so there will be no difference in perspective. Because of this I figured template matching would be an easy solution here, but I’m having difficulties trying to match multiple template images to the input image.
So simply put: There are template images of the playing cards which contain the rank and the suit. The picamera takes a picture of a card (which always will be in the same position above the camera) and I want to match this taken picture with the different templates of all possible playing cards.