Augr · Lab Project
High-Fidelity TCG Data Rectification
A deterministic computer-vision pipeline that ingests skewed ADF scans and emits a canonical digital twin of physical Magic: The Gathering cards — geometry rectified, corners restored, foil indicators classified. Architecting sub-pixel precision for high-velocity TCG marketplaces.
The fidelity gap
In the high-stakes MTG secondary market, centering and condition are the price. Two degrees of roller skew in a consumer scanner clips the black border and turns a $50 card into something that looks like a $200 misprint — or a scam. Consumer-grade tooling fails the buyer's eye on three axes:
- Digital miscuts — simple rotation clips iconic black borders.
- Geometry loss — fixed-margin crops destroy the 3.5mm corner radius signature.
- OCR failure — Tesseract cannot distinguish the foil star (★) from the non-foil dot (•) in the footer.
Architecture · three phases
- Phase A · Isolate. Bilateral blur → Canny edge detection → external contour with >50% area threshold.
- Phase B · Warp. 4-point perspective transform into a 750×1050 canonical canvas.
- Phase C · Normalise. Levels correction, alpha-mask anti-aliased 3.5mm radii, template-match foil indicator.
The runtime is pure classical CV — no multimodal LLM in the hot path. Claude Code lives above the pipeline as a build-time co-architect.
Stack
Python · OpenCV · NumPy · Pillow · Canny edge detection · 4-point perspective warp · Claude Code (build-time co-architect).
Outcomes
- 100% geometric fidelity. Perspective-induced false-miscuts eliminated.
- 0.95 confidence on foil ★ vs non-foil • classification via template matching.
- <2% human intervention — exception handling on novel frame layouts only.
Key learning · the inner-frame trap
The hardest week of the project: early versions snapped to the card's internal title bar rather than the outer black border. Modern MTG frames have so much internal geometry that a naive contour algorithm sees structure everywhere and picks the wrong shape every time. The fix was a one-line filter change: from cv2.RETR_LIST to cv2.RETR_EXTERNAL plus a >50% area threshold. A Principal architect's job is finding the one constraint that makes the whole system click into place.