Pi 3 and camera spot playing cards in live feed

Nov 07, 2026 Last reply: 22 hours ago 3 Replies
Jump to replies (3)

The trickiest part of any card reader setup is getting a reliable match out of a messy live image, and that is where the maker put the real work in this build. The feed goes through a greyscale conversion, then a blur, then thresholding, which cleans the scene up enough for contours to be found. From there the pipeline is genuinely well thought out: each card contour gets perspective warped to flatten it, the upper corner is cropped and zoomed 4x, and the rank and suit are separated and compared against pre-saved training templates using pixel subtraction. The flattened card images are generated at 200 by 300 pixels, a size that seems a sensible balance between detail and processing load on a Pi 3.



Project by Edje Electronics. Watch it on their YouTube channel:

formatting link


The 4x zoom on the upper corner before matching looks like the smart move to me. Zooming in on a small region means the pixel subtraction works on a cleaner, larger rank and suit instead of a whole card full of noise, and it should make the template comparison far more forgiving. The trade-off is that any warp error in that corner hits the match hard, but on a flat dealing surface that seems acceptable.

Question about the camera rig: the camera is held to a cardboard boom arm with rubber bands. Does the slight give from the rubber bands cause any drift in the perspective warp, or is the corner crop tolerant enough that small movements do not affect the rank and suit separation? Curious how stable the mount needs to be for the matching to hold.

One concrete improvement to consider: since the maker already plans Haar Cascade Classifiers for rank and suit combinations, the same trained cascades could double as a sanity check on the pixel subtraction results. If both methods agree on a card, confidence is high; if they disagree, the frame could be skipped. That kind of cross-check might also help with the half-visible card cases the current pipeline struggles with.

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required