Python tool using tesseract to OCR a screenshot of a valorant end game scoreboard and turn it into a csv file.
Written by Alex 'Aplox' Porter (twitter.com/_Aplox). Huge thanks to Vladk0r (twitter.com/vladk0r_vlr) for pushing me to finally do this!
This repository containts two files.
- File with the class and all of the functions (scoreboard_reader.py)
- File for running the OCR tool to gain a csv file (table_to_ocr.py)
The first thing you need is a screenshot of a scoreboard like this: The tool has been tested on English and Turkish language screenshots. The tool only works on screenshots in 16:9 aspect ratio currently. Unfortunately more testing is required to work with stretched resolution screenshots.
The script will initially ask for a file name i.e. screenshot.png. This can be modified in the run script if you wish to hardcode the name in.
The tool then splits the image by row and then each row by cell. Each cell is then passed through tesseract and converted to a string which can be output.
The output is as a csv file. The script will prompt if you want the file in EU (; as delimiter) or UK (, as delimiter) format. It is possible to hardcode this into your personal version by altering the write_csv function.
The output should look something like this:
The output is sorted alphabetically by name such that all of your team with the same tag should be grouped together.
Firstly you need tesseract-OCR. Instructions to install here:
https://medium.com/@ahmedbr/how-to-implement-pytesseract-properly-d6e2c2bc6dda
python dependencies:
sys, opencv, numpy, pytessetact, math, csv, tqdm and PIL.
All dependancies may be installed using the following command:
pip3 install -r "requirements.txt"
Coming soon?