Menu:

OpenCV-Python Playing Card Detector


Description

Due to a growing interest in both image processing and blackjack, I decided to embark on a project to create a blackjack-playing robot that uses image processing to count cards and make hit or stand decisions. My end goal for the project is to have a camera mounted on a 3D-printed robot that can be placed on a card table, have a hand of blackjack dealt in front of it, and use a lookup table to decide what play to make, all while counting cards. It will implement card counting strategies, making it the perfect blackjack player. 

A (poor) depiction of what my blackjack-playing robot will look like!

The first phase of this project required developing a program that could be used to detect and identify the cards. After several months of learning a widely-used image processing library called OpenCV, I successfully created a playing card detector program. It’s written in Python and optimized to run on the relatively low-power Raspberry Pi 3. 

I made a video describing what the card detector does and how its image processing algorithm works. Check it out! 


The full source code for the program is located at the Github repository here.

The project is still a work in progress, and I’m a long way from having a functional prototype. I’m excited to continue applying my creativity, learn more about image processing, and make more YouTube videos as I work on completing the project! 


Project Takeaways

I pursued this project to learn about image processing and build my programming experience with Python. Working on this project has grown my expertise in: