Finding best match between a set of images using template matching?

12 ビュー (過去 30 日間)
ROHIT AILA 2016 年 10 月 4 日
回答済み: Dimitris Iliou 2016 年 10 月 11 日
I am working on a project that has to determine multiple playing cards on a poker table. I have separated the cards using regionprops but i am not able to recognize the cards. I have tried SIFT, but it does not return the correct match and it tends to take a lot of time. I tried training OCR and surprising that failed too even in the cards that i trained it for. I am considering to use template matching. But since template matching identifies a template in every image, how do i know which image contains the actual template.

回答 (1 件)

Dimitris Iliou
Dimitris Iliou 2016 年 10 月 11 日
As I understood, you want to do image to image matching, and SIFT and OCR methods did not perform very well for your exercise.
Template matching could be a possible solution, but you would have to take into consideration the following aspects of your setup.
Specifically, when you use SIFT, the rotation, translation or scaling of the images, is not important and the algorithm will be able to find common features. On the other hand, if you use template matching, you will have to registrate the different cards on the table so that they are in the same scale and alignment.
One template matching function you can use is the ‘step’ matching function of the Computer Vision System Toolbox. The documentation for that function is in the following link:
To answer your question, the ‘step’ matching function can provide an output called ‘Metric Matrix’. From that matrix you can find the minimum metric between the image you used as test vs the training set. The element that corresponds to the minimum value of the matrix should be the card you are trying to find.
I would also suggest a different approach called ‘Image Classification with Bag of Visual Words’. You can find more information about it in the following link:
This method will allow you to create clusters based on the features of the training set (in your case, the numbers and the suits) and then perform classification to find which cards are on the table.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by