На код не смотрите я учусь
from PIL import Image, ImageGrab #Cкриншоты import cv2 import pytesseract #определение цифр img1 = ImageGrab.grab( (1697,410,1787,447) )#Скрингот заданной области img1.save("picture.jpg")#Сохранение скриншота image = cv2.imread("picture.jpg") #Открытие скришота T, image2 = cv2.threshold(image, 215, 255, cv2.THRESH_BINARY)#Делаю черно белым cv2.imwrite('graygirl.jpg', image2)#Сохарнение черно белого pytesseract.pytesseract.tesseract_cmd = r'C:\Users\Desktop\AppData\Local\Programs\Tesseract-OCR\tesseract.exe' question_text = pytesseract.image_to_string(Image.open("picture.jpg"))
терминал
Traceback (most recent call last): File "C:\Users\Desktop\Desktop\Машенист\main.py", line 11, in <module> question_text = pytesseract.image_to_string(Image.open("picture.jpg")) File "C:\Users\Desktop\Desktop\Машенист\venv\lib\site-packages\pytesseract\pytesseract.py", line 409, in image_to_string return { File "C:\Users\Desktop\Desktop\Машенист\venv\lib\site-packages\pytesseract\pytesseract.py", line 412, in <lambda> Output.STRING: lambda: run_and_get_output(*args), File "C:\Users\Desktop\Desktop\Машенист\venv\lib\site-packages\pytesseract\pytesseract.py", line 287, in run_and_get_output run_tesseract(**kwargs) File "C:\Users\Desktop\Desktop\Машенист\venv\lib\site-packages\pytesseract\pytesseract.py", line 263, in run_tesseract raise TesseractError(proc.returncode, get_errors(error_string)) pytesseract.pytesseract.TesseractError: (1, 'Error opening data file D:\\Tesseract-OCR\\eng.traineddata Please make sure the TESSDATA_PREFIX environment variable is set to your "tessdata" directory. Failed loading language \'eng\' Tesseract couldn\'t load any languages! Could not initialize tesseract.')