Search code examples
pythonpython-tesseract

Tesseract OCR cant recognize simple math symbols


so basicly im trying to make tesseract ocr do some elementary school math, but it wont work it prints out the math but not the answer to the math, here is my code

import pytesseract
pytesseract.pytesseract.tesseract_cmd = r'C:\Users\alloa026\Downloads\project\photo.png'
content = pytesseract.image_to_string(r'C:\Users\alloa026\Downloads\project\photo.png')
print(eval("content.strip()"))

anyone know how to fix this?


Solution

  • have you note that, you should correct the last line

    print(eval("content.strip()")
    to
    print(eval(content.strip())