关于图片转文字的问题
代码如下:import pytesseract as py
from PIL import Image
path = r'f:\777\66\55\Tesseract-OCR\tesseract.exe'
py.pytesseract.tesseract_cmd = path
img = Image.open(r'f:\777\66\shot\my_shot.png')
text = py.image_to_string(img)
print(text)
能运行只是最后会出错
Traceback (most recent call last):
File "<pyshell#10>", line 1, in <module>
py.image_to_string(img)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pytesseract\pytesseract.py", line 409, in image_to_string
return {
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pytesseract\pytesseract.py", line 412, in <lambda>
Output.STRING: lambda: run_and_get_output(*args),
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pytesseract\pytesseract.py", line 287, in run_and_get_output
run_tesseract(**kwargs)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pytesseract\pytesseract.py", line 263, in run_tesseract
raise TesseractError(proc.returncode, get_errors(error_string))
pytesseract.pytesseract.TesseractError: (1, "Tesseract Open Source OCR Engine v3.05.00dev with Leptonica read_params_file: Can't open txt Warning in pixReadMemPng: work-around: writing to a temp file libpng warning: Application built with libpng-1.4.3 but running with 1.5.14 Error in pixReadStreamPng: png_ptr not made Error in pixReadMemPng: pix not read Error in pixReadMem: png: no pix returned Error during processing.")
求哪位大师能看一下是什么原因? 是我tesseract 安装有问题吗?
页:
[1]