# Card recognition: CollectorVision (AGPL-3.0)

The Scan page recognises cards on your device with **CollectorVision**
(https://github.com/HanClinto/CollectorVision), Copyright HanClinto (Clint Herron),
licensed under the GNU Affero General Public License v3.0 or later. The full licence
text is in [LICENSE](LICENSE) next to this file.

## What in this app is CollectorVision

Everything CollectorVision-derived is kept in this folder and the model files it loads:

| File | What it is | Licence |
|---|---|---|
| `/static/cv/scanner.worker.mjs` | Recognition worker: detect card corners, dewarp, embed, search. **Modified** from upstream `examples/web_scanner/scanner.worker.mjs` (commit `2a122d00`); the changes are listed at the top of the file. This served file is its complete source. | AGPL-3.0-or-later |
| `/cv-assets/detector-*.onnx` | Corner detector model, cornelius-2.12, unmodified | AGPL-3.0-or-later (upstream release `web-scanner-assets`) |
| `/cv-assets/milo-*.onnx` | Card embedder model, milo-1.0.0, unmodified | AGPL-3.0-or-later |
| `/cv-assets/embeddings-*.bin`, `/cv-assets/card-ids-*.bin` | Catalog of 109,711 Scryfall printings (bundle `milo1-scryfall-mtg-2026-07-09`). The embedding matrix is split into two byte-identical parts; the id list is re-encoded from JSON to binary in the same order. | AGPL-3.0-or-later |
| `/cv-assets/ort*.mjs`, `/cv-assets/ort-wasm-*.wasm` | onnxruntime-web 1.24.3 (Microsoft), unmodified | MIT (`/cv-assets/LICENSE-onnxruntime-web.txt`) |

The rest of the app talks to the worker only by messages (it sends camera frames, it
gets back ranked Scryfall ids). `tools/scanner_assets.py` builds `/cv-assets/` from the
upstream release and documents each step.

CollectorVision's author also offers a free noncommercial licence and a commercial
licence as alternatives to the AGPL (see upstream `COMMERCIAL_LICENSE.md`).

Card images and data: Scryfall. Magic: The Gathering is © Wizards of the Coast.
