Никак не могу разобраться как запустить этот код.
Установил Tesseract OCR по этому гайду https://www.youtube.com/watch?v=Rb93uLXiTwA&ab_channel=AllroundZone и на ввод в консоль tesseract он отзывается.
Установил opencv-python c помощью pip install opencv-python
Установил pytesseract pip install pytesseract
from cv2 import cv2
import pytesseract
img=cv2.imread("test.png")
im=cv2.resize(img,None,fx=9,fy=9)
like=pytesseract.image_to_string(img,config='outputbase digits')
print(like)
Выводит такое
Traceback (most recent call last):
File "C:\Users\dkati\AppData\Local\Programs\Python\Python39\lib\site-packages\pytesseract\pytesseract.py", line 255, in run_tesseract
proc = subprocess.Popen(cmd_args, **subprocess_args())
File "C:\Users\dkati\AppData\Local\Programs\Python\Python39\lib\subprocess.py", line 947, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "C:\Users\dkati\AppData\Local\Programs\Python\Python39\lib\subprocess.py", line 1416, in _execute_child
hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
FileNotFoundError: [WinError 2] Не удается найти указанный файл
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "e:\py projects\content\img_to_str.py", line 10, in <module>
like=pytesseract.image_to_string(img,config='outputbase digits')
File "C:\Users\dkati\AppData\Local\Programs\Python\Python39\lib\site-packages\pytesseract\pytesseract.py", line 409, in image_to_string
return {
File "C:\Users\dkati\AppData\Local\Programs\Python\Python39\lib\site-packages\pytesseract\pytesseract.py", line 412, in <lambda>
Output.STRING: lambda: run_and_get_output(*args),
File "C:\Users\dkati\AppData\Local\Programs\Python\Python39\lib\site-packages\pytesseract\pytesseract.py", line 287, in run_and_get_output
run_tesseract(**kwargs)
File "C:\Users\dkati\AppData\Local\Programs\Python\Python39\lib\site-packages\pytesseract\pytesseract.py", line 259, in run_tesseract
raise TesseractNotFoundError()
pytesseract.pytesseract.TesseractNotFoundError: tesseract is not installed or it's not in your PATH. See README file for more information.