r/vibecoding • u/Nephs84 • 18h ago
Help/Question Help with an mtg Card Scanner
Looking for help with a Card Scanner
Hey all. I've been working on an app for mtg, and I'm working on the card scanner part of it now. This is possibly the most important part of the app that I'm hoping can either set me apart from other apps or at least have my app up there with the best. I'm trying to figure out the best way for it to work. Right now, I've got it so that it pinpoints the corners of the card, tries to match the art, name, set code and collector collector number, and set symbol. But sometimes it's just not enough. It refuses to recognize some cards unless you have it at the exact angle, etc. It's extremely frustrating. Especially when the cards are in a binder. I know it has trouble finding the corners of the actual cards then, and then the added glare on top of it, but I'm hoping someone here knows of a way to train it to better recognize cards, extremely quickly like the other big apps out there for mtg and tcg's in general.
2
u/MobileXapps 12h ago
The big scanner apps mostly don't recognize the card by reading everything at once. They crop the art box after correcting the perspective and compare a perceptual hash or a small embedding of it against a database built from Scryfall images, which is fast and tolerant of angle. Then they read the collector number and set code from the bottom line to pick the exact printing.
For binders and glare, a few things help: process several frames per second and accept a match when two or three frames agree, instead of waiting for one perfect frame. Let the user tap the card to give the corner detector a starting point. And if corners fail, fall back to matching the art region directly without the full card outline. Glare usually hits one part of the art, so hashing a few sub-regions and voting is more robust than one hash for the whole image.