OCR with tesseract -> just bad results [AutoIt]

05/17/2019 08:02 o4314990#1
Hey guys,

i need your help with OCR:

Im trying to read a PIN from a game (WWE Supercard), and want to input the code to the virtual keyboard of the game.

The layout of the keyboard and the buttons is always a bit random, but this i can check with autoit and image search.

The main problem i have, is that the ocr ressult is always wrong.

I take a screenshot of the area with the pin code (with AutoIt, from Nox Player), save it as BMP (also tried jpg and png) and use tesseract to scan the image.

I have big problems with the results. A 5 is a 6, or 8 and 6 is always a B.
I tried with imagemagick to preprocess the image to b/w and other parameters, but the result is always poor and not accurate.

Tried with Tesseract 3.x and 4.

I use this code to get the OCR result:
C:\Users\username\Downloads\TesseractExample\tesse ract.exe, C:\Users\username\Downloads\TesseractExample\einga befeld_10.bmp, C:\Users\username\Downloads\TesseractExample\resul t.txt

Image files are attached.

Does anyone have a solution to scan this text?
05/17/2019 15:08 Shadow992#2
Tesseract is not really optimized for tasks like this. I guess the easiest and best solution is to write some small code on your own for this you can have a look at this:
[Only registered and activated users can see links. Click Here To Register...]

It is mostly C++ based code but I guess you can still figure out how you can use this for AutoIt.
05/18/2019 09:00 o4314990#3
Thx, I'll try it
05/18/2019 09:29 False#4
#moved
05/18/2019 11:49 Interløgy#5
Tesseract provide a class names "ImageHelper", there are some static methods to provide a better picture.

in my last Java project it looks like this:
Code:
public static BufferedImage improveQuality(BufferedImage subimage) {
    subimage = ImageHelper.convertImageToGrayscale(subimage);
    subimage = ImageHelper.convertImageToBinary(subimage);
    subimage = ImageHelper.getScaledInstance(subimage, subimage.getWidth() * 3, subimage.getHeight() * 3);
    return subimage;
}