Skip to content

Script that uses tesseract and CV2 to identify the magic card given and returns what formats its legal in

Notifications You must be signed in to change notification settings

LetheTheForgotten/MTG-Card-Format-Identifier

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 

Repository files navigation

MTG Card Format Identifier

Script that uses tesseract,opencv and the scryfall api to tell you what formats the card your camera is pointing at is legal in.

Prerequisites:

Tesseract OCR

This is the text recognition engine used by the code. If it is not located in "C:/Program Files/Tesseract-OCR/" you will have to change a line of the code to locate the tesseract executable.

pytesseract

requests

pillow

opencv

Usage:

run the script as you would any other python script.

line up the card name as well as you can within the green box.

press "y" to run the contents within the box through an OCR.

Read the Console to find out if that card is legal.

press "q" to close all camera windows before ending the script.

Troubleshooting:

Tesseract only supports english by default, you will have to tell it to install other languages. In my experience it does not like accented characters, an "Ü" is consistently read as "ii".

Keep requests to under 10 a second. This is outlined as a limit in the scryfall API.

I recomend you only have a single camera connected while running this.

Questions? Concerns? Complaints?

If you're hasbro and want to file a legal complaint I am not claiming to represent you in any capacity, Magic: The Gathering and all related content is copyright Wizards of the Coast, LLC. This Script is not produced by or endorsed by Wizards of the Coast.

If theres a bug or you just want to ask a question you can reach me at twitter or bluesky

I will probably update this to be more useful outside of my very specific niche thing that bothered me at some point.

About

Script that uses tesseract and CV2 to identify the magic card given and returns what formats its legal in

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages