Coder Social home page Coder Social logo

draftgpt's Introduction

DraftGPT

Magic: The Gathering Online OCR from arbitrary screen selection in Python


Usage

python cardfinder.py

  • This will pop up a window on your main screen to select a bounding box to search for multiple cards.
  • Drag from top left to bottom right, type 'w' to confirm selection
  • A second window will pop up to show cards and their names as found by cv2 and identified by tesseract
  • While the second window is open, you can scroll slowly through any number of cards, type 'q' to exit this window
  • On close, the total unqiue list of cards seen is compiled, and card details are retrieved from Scryfall fuzzy search API
  • Example usage: Youtube Example

Notes

  • It's recommended to make the individual card size as large as possible in mtgo.
  • Code has only been run on windows, Mac OS and Linux use at your own risk.
  • Google how to set up tesseract
  • If your python cannot find the executable from PATH, add the line pytesseract.pytesseract.tesseract_cmd = r'C:\Program Files\Tesseract-OCR\tesseract.exe' to the beginning of cardfinder.py
  • To speed up processing, a forked pytesseract is in the repo, the change implements tesseract read from stdin rather than writing image to disk, based on this comment
  • An attempt at multithreading was made in cardfinder_multithreaded.py but is much slower, even after limiting tesseract to single-threaded. Slightly more accurate, but twice as slow.

Dependencies

  • pytesseract fork in repo
  • PIL
  • cv2
  • pynput

draftgpt's People

Contributors

trentshapiro avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.