We see a lot of Raspberry Pis used to play games, but this is something entirely different from the latest RetroPie build. This Raspberry Pi is learning how to read playing cards, with the goal of becoming the ultimate card counting blackjack player.
If [Taxi-guy] hasn’t named his project Rain Man, we humbly suggest that he does so. Because a Pi that can count into a six-deck shoe would be quite a thing, even though it would never be allowed anywhere near a casino. Hurdle number one in counting cards is reading them, and [Taxi-guy] has done a solid job of leveraging the power of OpenCV on a Pi 3 for the task. His description in the video below is very detailed, but the approach is simple: find the cards in a PiCam image of the playing field using a combination of thresholding and contouring. Then, with the cards isolated, compare the rank and suit in the upper left corner of the rotated card image to prototype images to identify the card. The Pi provides enough horsepower to quickly identify an arbitrary number of non-overlapping cards; we assume [Taxi-guy] will have to address overlapping cards and decks that use different fonts at some point.
We’re keen to see this Pi playing blackjack someday. As he’s coding that up, he may want to look at algorithmic approaches to blackjack strategies, and the real odds of beating the house.
11 thoughts on “A Raspberry Pi Rain Man In The Making”
> “even though it would never be allowed anywhere near a casino”
You could always develop and sell a system to casinos who already have live and recorded video feeds from every table. To automatically check for card counters, by validating if each gambler is betting in such a manor that would statically indicate card counting.
I suspect that they would already have at least one such mobile system, but something that is orders of magnitude cheaper, faster and could analyse multiple concurrent tables without an exorbitant yearly per seat licensing fee could be a persuasive argument that it is time for a system upgrade.
How much do you want to bet they’ve had a system like that in place on every table for at least 5 years?
More complicated than it really needs to be. They just keep an eye on the money / percentage per table. Any irregularity gets noticed real quick.
This is the first projects that has made me consider buying a Pi. Until now I’ve always scratched my head over why people would just use an old laptop or an Arduino.
I’m integrating the Pi into a product :-) Just enough horsepower to be perfect for the job, can write in a familiar language, good enough community support…
‘Course I’m an excellent driver
This project is great! I still want a program to read a stack of cards and print out the order. This might be a good start.
For those interested, here is my project page on Hackaday for the project! And I did decide to dub the blackjack robot as RainMan 2.0!
Please be kind and respectful to help make the comments section excellent. (Comment Policy)