Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dills122/mtg-card-analyzer
Analyze images of MTG cards
https://github.com/dills122/mtg-card-analyzer
image-analysis magic-the-gathering mtg mtg-cards ocr
Last synced: 8 days ago
JSON representation
Analyze images of MTG cards
- Host: GitHub
- URL: https://github.com/dills122/mtg-card-analyzer
- Owner: dills122
- License: mit
- Created: 2019-04-20T05:06:28.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2023-02-27T09:04:52.000Z (almost 2 years ago)
- Last Synced: 2023-03-02T19:56:57.295Z (almost 2 years ago)
- Topics: image-analysis, magic-the-gathering, mtg, mtg-cards, ocr
- Language: JavaScript
- Homepage:
- Size: 14.2 MB
- Stars: 7
- Watchers: 2
- Forks: 3
- Open Issues: 24
-
Metadata Files:
- Readme: Readme.md
- License: LICENSE
Awesome Lists containing this project
README
# MTG Card Analyzer
[![CI Job](https://github.com/dills122/MTG-Card-Analyzer/actions/workflows/ci.action.yml/badge.svg)](https://github.com/dills122/MTG-Card-Analyzer/actions/workflows/ci.action.yml)
[![CodeFactor](https://www.codefactor.io/repository/github/dills122/mtg-card-analyzer/badge)](https://www.codefactor.io/repository/github/dills122/mtg-card-analyzer)A collectors dream application, that gives you the ability to take pictures of your cards and have them instantly be recognized and added to your collection. This app will scan each image uploaded attempt to grab the name of the card and analyze the set image in an attempt to match it with a given set.
## Example
Here is a test extraction:
### Original Card
![]()
### Name Extraction
Extracted Text: `g Platinum Angel`
Cleaned Extracted Text: `gPlatinumAngel`
#### Before Pre Processing
![]()
#### After Pre-Processing
![]()
### Type Extraction
Extracted Text: `E Artifact Creature —- Angel`
Cleaned Extracted Text: `EArtifactCreatureAngel`
#### Before Pre-Processing
![]()
#### After Pre-Processing
![]()
More examples are available [here](https://github.com/dills122/mtg-card-analyzer/tree/master/src/test-images)
## Getting Up And Running
### Getting Started
Clone repo
> `git clone https://github.com/dills122/MTG-Card-Analyzer.git`Install dependencies
> `npm i`Navigate to the repo's directory, you will need to setup a few things first
* Run this script to seed your local name dictionary
* `node .\src\db-local\bulk-insert.js`
* Create an RDS instance in AWS or any other mySql db provider
* Create a `secure.config.js` with your mySql credentials (Schema below)
* All sql scripts are located in `src\data\scripts\sql`, run all the table create scripts#### Secure Config Schema
A template is avaliable [here](./secure.config.template.js)
```
rds: {
host: '...',
database: '...',
user: '...',
password: '...'
}
```### First Test Run
Once all of the setup is complete to run your first image through the processor you can use one of the test images or use the given command below.
```
# Run at the base directory of the repo
node index.js scan ./src/test-images/PlatinumAngel.jpg
# Might need to run as sudo on linux
```### Current Commands
* `scan ` : this command scans a single image and outputs the results to the terminal
* flags:
* `query` or `q`: for disabling database manipulation (default `true`)
* `file` or `f`: for processing an output file (default `false`)Test images are provided at `src\test-images`
Backfiller utility instructions found [here](https://github.com/dills122/MTG-Card-Analyzer/wiki/Backfiller)
### Packages Under the Hood
* `fuzzyset.js`
* `image-hash`
* `jimp`
* `string-similarity`
* `tesseract.js`