Let The Cards Fall Where They May, With A Robotic Rain Man

Finally,  a useful application for machine vision! Forget all that self-driving nonsense and facial recognition stuff – we’ve finally got an AI that can count cards at the blackjack table.

The system that [Edje Electronics] has built, dubbed “Rain Man 2.0” in homage to the classic title character created by [Dustin Hoffman] for the 1988 film, aims to tilt the odds at the blackjack table away from the house by counting cards. He explains one such strategy, a hi-low count, in the video below, which Rain Man 2.0 implements with the help of a webcam and YOLO for real-time object detection. Cards are detected in any orientation based on their suit and rank thanks to an extensive training set of card images, which [Edje] generated synthetically via some trickery with OpenCV. A script automated the process and yielded a rich training set of 50,000 images for YOLO. A Python program implements the trained model into a real-time card counting application.

Rain Man 2.0 is an improvement over [Edje]’s earlier Tensor Flow card counter, but it still has limitations. It can’t count into a six-deck shoe as the fictional [Rain Man] could, at least not yet. And even though cheater’s justice probably isn’t all cattle prods and hammers these days, the hardware needed for this hack is not likely to slip past casino security. So [Edje] has wisely limited its use to practicing his card counting skills. Eventually, he wants to turn Rain Man into a complete AI blackjack player, and explore its potential for other games and to help the visually impaired.

Continue reading “Let The Cards Fall Where They May, With A Robotic Rain Man”

A Raspberry Pi Rain Man In The Making

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.

Continue reading “A Raspberry Pi Rain Man In The Making”

Performance Oddities

[Mario the Magician] wrote in to let us know that he makes Hackaday a priority every morning with his coffee. Well, so do we. He also included a link to his homepage when submitting this revelation. The juicy details that are as much of a fix as the caffeine in the coffee are missing from his posts. But the hacks are solid.

Magicians are hackers. If you could go out and buy the props, the concept are unlikely to impress anyone. [Mario] demonstrates his Nickel Box and a Jedi Mind Trick he built. The Nickel Box is a mechanical contraption that somehow transports a coin from one part of a cigar box to a tiny little enclosure on top of it. The Jedi Mind Trick uses a microcontroller and an old Star Wars soundtrack cassette tape box to put on a light and sound show while it recovers your chosen card from a shuffled deck. Great demonstrations, but no word on what’s going on inside.

[Mario’s] also has a collection of… performance oddities. His talking television takes an audio input and displays a 1950’s-esque oscilloscope effect on an old TV. He’s attempting to stop his heart, or burn the house down, or both with a flyback transformer lightning box. And his drawing automaton, well, you’ll just have to see it.

We believe in electrons, not magic (even though some say there are no electrons). So we want to know how those magic props are built. Like any good magician, [Mario] probably won’t reveal his secrets. If you’ve got the goods this your chance. Write a post detailing your magical prop builds and send them our way. If it’s well done we’ll feature it here on Hackaday.

Jak, The Blackjack Robot

[Paul] sent in this Robotfest 2009 exhibition competition entry. This is Jak, the blackjack robot. This seems to be a convergence between a digital game of blackjack and a physical game. The robot scans each card as it deals them and feeds the data to a piece of software that tracks each players hand.  The players select their next step on the screen and the robot responds appropriately. They have won 1st place in the Ontario competition and are now going to the international level. Jak wins a round in the video, but we didn’t see him celebrating. Come on guys, make him flash some lights or talk some trash.