I CoPilot vibe coded python script that uses a webcam, Pokémon cards, OpenCV to detect motion, take a picture, use Azure vision to read text, look for the card code and number, and output that to a usable file.
After getting the code and number of the card, it looks it up with https://tcgdex.dev/
Coded to get an index over all my scarlet & violet era bulk cards, used for playing. Only works on regulation mark G and higher.
I use this box from Clas Ohlson https://www.clasohlson.com/no/SmartStore-innsats-for-Home-og-Classic-4-og-14/p/44-5238-7
And a Trust 23637 Webcam on my M3 Mac
Demo of setup is found here https://www.youtube.com/watch?v=TthLfjK-2t0
python3 cardscan.py Ctrl C or escape ends scanning Holding space takes a picture if motion is not detected
It outputs (appends) a json and a Excel spreadsheet
python3 cardcount.py takes the output json, count and sort it. Outputs to excel spreadsheet.
Uses python3 and pip3
Setup env: python3 -m venv /cardScan
Select env to use: source /cardScan/bin/activate
pip3 install azure-ai-vision-imageanalysis
pip3 install opencv-python
pip3 install playsound or if that does not work, install with: pip3 install playsound@git+https://github.com/taconi/playsound
To use playsound with python3 pip3 install PyObjC
Set up a Azure Vision service https://portal.azure.com/
Add a subscription. The free tier has 20 Calls per minute, 5K Calls per month, but needs a credit card on file.
Get KEY 1 and endpoint from the bottom of the Overview page.
export VISION_KEY=<your_key>
export VISION_ENDPOINT=
set VISION_ENDPOINT=https://.cognitiveservices.azure.com/
set VISION_KEY=