Image recognition ideas for playing cards?

I have no camera/image experience with Arduino, but I think if I use a fast STM32F103C8T6 I might be able to do the following:

  1. In B&W, capture an image of the top left index of a card at close range-only as much resolution as necessary.
  2. Locate & identify 'suit' symbol.
  3. Locate & identify 'number' (pip) symbol (A, 2, 3, 4, 5, ..., J, Q, K)
  4. Make a decision based on the numeric representation of suit & value.
  5. Advance a rubber wheel or some other mechanism to show the next card.

Nothing fancy here, but this might end up in the NN (neural network) area, with a supervisor-trained network, which I've no trouble with programmatically.

But what about a plain image match? 4 suit images and 13 'pip' images? Cold a 72MHz processor go through 17 images for a match fast enough?

"Fast enough" is defined as something like a rubber wheel on a stack of cards, with the cards being advanced as soon the top one is recognized, going through them at as rapid a rate as possible, say, several each second. The faster the better, but the details of what to do if not recognized in X time, etc. aren't of concern immediately.

The crux, though, is whether a lo-res B&W camera can be made to do this at close range to the card (1" or less), as in how would the images be stored in the MCU memory so as to allow the fastest lookup...

I'm just starting to flesh this out... Any thoughts?

TIA!

I'd base a system like that off something with real processing power - like a Raspberry Pi.

But what about a plain image match? 4 suit images and 13 'pip' images? Cold a 72MHz processor go through 17 images for a match fast enough?

Short answer: no. The main limiting factor is probably memory, 20kB of RAM is definitely not enough to do image recognition, even if you'd admit to wait for the result for minutes.

Nothing fancy here, but this might end up in the NN (neural network) area, with a supervisor-trained network, which I've no trouble with programmatically.

I don't think that neuronal network is the best fit for this. Take a look at the OpenCV library, many of your problems are already solved there. And a feasible computer for this task (the Raspberry Pi was already mentioned but is just one possibility) would run that library.

Is this a standard deck of cards? If you could put a QR code on the cards you would probably make your job easier. If it is a standard deck then the upper left of the card will have digit/s or a letter plus a symbol defining the card. I am not sure how much the positioning and type faces differ between different decks. I suppose though you only have four symbols in two colours so the image recognition part might be relatively simple.

It still sounds though like something not well suited to an Arduino

You need something able to run OpenCV2 at least (use the python interface, not C++), and read up on
correlation techniques for shape recognition.

You can't do this easily on a microcontroller. OpenCV under python is the best bet for prototyping
something quickly.

MarkT, why would you tell OP not to use C++ with OpenCV? C++ is faster and (in my opinion) easier to use. I’ve used OpenCV with C++ and have found no problems with it.