Which settings should I use to convert an image to text using pytesseract/tesseract-ocr & cv2/opencv-python?

Viewed 27

After trying several configurations and options using pytesseract/tesseract-ocr and cv2/opencv-python I'm not able to make a clean translate from an image to text.

I have the full code in a github repo (goto model.py rewriteImange() functnion): https://github.com/onRubik/starcitizen-manage-your-money

summary:

if os_type == 'Windows':
    pytesseract.pytesseract.tesseract_cmd = r'C:\Users\<user_folder>\AppData\Local\Tesseract-OCR\tesseract.exe'

for x in read_file:
    img = cv2.imread(x)
    img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
    data = pytesseract.image_to_string(img, lang='eng', config='--psm 11')
    print(data)

Take a look at this image, this is the one I'm trying to convert (in the image you will see a clean translate but its because its using zenphi software): https://imgur.com/a/lCwdyJ4

Is there any tunning I can do with pytesseract/tesseract-ocr & cv2/opencv-python to achieve the same?

If I use my code to translate the previous image I get:

ALUMINUM

52

TUNGSTEN

109

QUARTZ

rea

CORUNDUM

303

BERYL

1244

LARANITE

1303

BEXALITE

2228

QUANTAINIUM

siz

0 Answers
Related