Ask Your Question
0

recognizing which card from 52

asked 2012-11-11 10:17:37 -0600

zerowords gravatar image

If you have ever seen the bridge column in the daily newspaper and wanted to deal it out, you were likely put off by the need to arrange a shuffled deck in the proper order. To reduce that step I want to hold each card, one at a time, in front of a digital camera connected to a PC, at a known distance and orientation, and for the PC to tell me where the card goes in the newspaper's deck after I have been prompted to type in the newspaper's hand in the order North's spades, North's hearts, etc.

My search for accomplishing this has suggested opencv for sure, and surf possibly. Can anyone confirm my suspicions and suggest more details, please?

The questions I have read regarding opencv which come close to this question, seem to be looking for objects somewhere in an image, but I want to make a match with one of 52 standard images.

My problem is a lot like when on the TV shows like CSI they try to match a perpetrator's face against a huge database of photos to identify the criminal, but here there are just 52 cards in the database. I don't know if opencv will work for this matching task and if it will, what are the features of opencv to apply?

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
1

answered 2012-11-12 05:16:24 -0600

Ben gravatar image

Having a defined set of just 52 database images isn't a big problem. And OpenCV will offer you the right tools to accomplish your task.

In my opinion, your biggest challenge will be to avoid false classifications, as your database images are very similar one to each other. If, for example, you are using SURF features, and trying to recognize an 8 of heart, it might be classified as a 7 or 9 of heart, because the set of extracted features will be very similar.

For a good overall classification result, you could consider some intelligent combination of one or more following classificators:

  • finding the card contours and mapping it to a rectangle
  • detect the card's color (red or black)
  • find contours within the card's rectangle and classify them as club, spades, heart or diamond using for example matchShapes()
  • count the occurences of a shape with using for example matchTemplate()
  • feature extraction and matching (e.g. with SURF and FlannBasedMatcher or BFMatcher)
  • ....
edit flag offensive delete link more

Comments

Can I assume your fourth step of counting occurrences is an attempt to count spots on the card? If so I was thinking it would be better to look in the upper left corner of the card at the 2,3,...,9,10,J,Q,K,A symbol to determine the cards value. Is that different from what you have suggested and if so can you comment, please, on the revisions required and efficiency of that approach? I am not familiar with SURF and FlannBasedMatcher. Are they internal to openCV or provided by other sources?

zerowords gravatar imagezerowords ( 2012-11-15 08:13:10 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2012-11-11 10:17:37 -0600

Seen: 2,397 times

Last updated: Nov 12 '12