Card tricks would be a lot easier if the magician knew the location of every card. Paul Nettle and Jeroen Van Goey created a Github project, ‘The Nettle Magic Project,’ that uses special markings and a camera to identify and locate every card in a deck.
Each card in the deck is marked with a unique barcode. Of course, if the cards were marked in traditional ink, that would disrupt the illusion, so the cards are marked with ink only visible under specific IR conditions. Nettle and Van Goey designed a Raspberry Pi device with a NoIR camera to see the marked cards.
The device runs a scanning server, and it’s connected to an iOS client application, Abra, that shows what the server’s camera sees and the decoded deck. With the technology, magicians can know the ordered list of every card in the deck, which card(s) are missing, and even which cards are face-up in the deck. The device can be run while performing as it can scan/decode a 1080p image to an ordered deck in ‘as little as 4ms.’
The testbed applications provided are written for macOS and iOS, although there’s also support for Linux and the Raspberry Pi platform. There currently aren’t Windows or Android versions. The full documentation outlines the testbed application in detail.
There’s also a high-level overview of how the device works. While speed is important, correct results are critical. An error during a live performance is problematic. While scanning results can be incorrect, it’s very unlikely. Performance is improved by scanning several video frames rather than a single frame. The results of multiple frames are analyzed and combined. However, efficiency concerns are important, as the device will likely be hidden on a magician’s person and can’t become too hot or run out of power.
|High-level overview of the Nettle Magic Project system and its steps|
There’s an input video frame augmented by configuration parameters and a deck definition. The deck is searched, decoded, resolved and analyzed before a report is generated for the user. Each of these primary steps includes secondary and even tertiary processes, which are extensively outlined here.
Each playing card is about 0.3mm thick, and they’re scanned under low-light conditions using a narrow-band IR camera. Further, cards become worn, and some cards are held in someone’s hands, so the scanning process isn’t perfect. However, it’s ‘generally’ reliable. The ‘analyze’ phase tries to overcome a lack of confidence by combining results from scans that are ‘mostly’ correct with scans that ‘may actually be’ correct to generate a single ‘confident’ result.
|The Abra client shows the full results of the scan. We can see that this scan generated a high confidence value (98).|
Different scenarios produce failures, including the deck not being in the frame or too small, the readability check failing because the scanned video isn’t sharp, there being too few cards or just some other more generalized failure. There are also different success conditions, including low and high confidence results. Once all steps are complete, the final result is sent to the Abra client.
|One of these decks is marked. Can you tell which one?|
The documentation also shows how to generate marks using a Sharpie or a custom-printed stamp. The section on UV reactive inks isn’t complete yet, but there are some interesting details about creating a marked deck that looks normal to the naked eye.
If you like card tricks, you can try the Nettle Magic Project for yourself. All packages, tools and documentation are available on Github.
Image credits: Nettle Magic Project / Paul Nettle and Jeroen Van Goey / Github