鱼C论坛

 找回密码
 立即注册
查看: 2084|回复: 1

关于图片转文字的问题

[复制链接]
发表于 2021-6-21 09:51:59 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能^_^

您需要 登录 才可以下载或查看,没有账号?立即注册

x
代码如下:
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.")
求哪位大师能看一下是什么原因?
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复

使用道具 举报

 楼主| 发表于 2021-6-21 09:53:46 | 显示全部楼层
是我tesseract 安装有问题吗?
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|鱼C工作室 ( 粤ICP备18085999号-1 | 粤公网安备 44051102000585号)

GMT+8, 2025-1-15 06:51

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表