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: