Computer vision tool for E&P

Several months ago I wanted to learn python, for real on a real problem. As real problem I selected this one: a tool to partially automate an alliance log of titan hits.
It took me a while, but in the end I came up with something actually working and I’m going to share it with the community. I’m doing it mainly because I stopped developing it, but maybe out there someone is willing to repolish it (it is my first python program, so it is awful), add features, put it on github to allow community wide modifications, adapt the backbone to do other stuff (e.g. AW log), or whatever.

In short this tool takes in a list of screenshots of titan hit reports previously saved on your computer like these ones:

processes them one by one, guesses the names of the players and the corresponding scores, reports them in a table for user check and eventual corrections and save the data for later processing and presentation, like this:

Now below I’ll post the source code with a brief explanation for its use. Anyone can download it and modify it, I don’t want credits for it, I just would appreciate to be kept updated on eventual upgrades made by anyone.

I still hope SGG will add some reporting features to the game to save us from doing this kind of stuff, but until that does not happen…

Processing source code

Sample plot source code

(sorry to share like this, but the forum eats the leading whitespaces in each new line, which can make python code interpretation quite hard)

Usage:

Save your screenshots as PNG images in subfolder “venv/images” as shown on the first image above. Use alphabetically sorted names, usually screenshots already do that using a format like YYYY_MM_DD_mm_ss.
Run the script: the first time you will be greeted with a board which shows for every member the segmented part of the image for his name, its translation into plain text (OCR applied), the segmented part of the image for his score and its translation into plain text (OCR again). Will look like this one:

All names are red because none of them has been saved yet (this is the first processed image). You’ll have to check that the names and the scores are recognized correctly, and correct the errors as in this case:

corrections

I suggest to pay attention to i, l and j mostly. Scores are often correct.
Once you’re done click “Save” and close the window.
If there are other images queued the program will repeat the procedure with the next image, otherwise it will stop and you will be able to restart when you add a new screenshot to your collection.
This time some names will be green (the name is already on the list of names found in previous images), and some red (the name has not appeared yet, maybe a new player). Yellow is for names that are not recognized correctly, but they were already corrected in the same way on a previous image, so the program guesses that correction should be applied again. For example in the following Divine_Dee has been recognized as DivineiDee as it happened for the previous image, so the correction used in the previous image is automatically applied:

Starting from the second image, after doing your corrections you can click the button “Check”, to verify that all the names are correctly matched to the names in previous images (green background), except for new members (red background). A report on old, new and lost members will also appear.

Always remember to click “Save” once after you apply your corrections and to close the window to go to the next image.
The data will be saved in file saved_data.dat. Since I didn’t implement features to verify that you do not corrupt data (e.g. by clicking “Save” more than once on a single image), I suggest to always make a backup copy of saved_data.dat before rerunning the program again on a new batch of images.

Caveat:
  1. This is not a standalone program, you need a Python 3 interpreter to run it
  2. The code as it is won’t work with alphabets other than latin
  3. The code works well on screenshots taken with my phone and I did just small adaptations to make it robust for screenshots taken from a few other sources
5 Likes

Cool and fun project! :slight_smile:

1 Like

Thanks dude! I know that in the end it is not much faster than writing the numbers down on a google sheet, but this is a lot less error prone and a program has the potential to do any kind of things. Moreover, I really hate doing manually something that can be done by a machine, guess that’s why I do the developer for a living :slight_smile:

1 Like

This is amazing. Thanks for the work. I hope to find time this week to play with it.

Thanks dude :slight_smile:
You’ll need the proper libraries, some a bit tricky: opencv with its contribs (but if I recall correctly adding it with pycharm IDE was a piece of cake) and tesseract which is called as a standalone executable, so you’ll need to add it to your system path (or call the executable full path from within the code).
Next week end might add a setup EDIT to the original post.
Btw if you need any help feel free to ask!

Hi alcaselzer…

Im so glad I found this post. Currently trying to use python with tesseract to automatically read the titan log hits and input it into a csv file so I can copy and paste it over to a spreadsheet.

Not gonna lie. Complete technophobe so using the brains of my programmer roommate to help me - along with google.

Ill keep you updated on how he does.

1 Like

Cookie Settings