繁体   English   中英

pyTesseract不从图像输出文本

[英]pyTesseract not outputing text from image

也许有人可以帮助我! 当我运行以下代码时

从 pytesseract 导入 pytesseract 从 PIL 导入 image_to_string 导入图像导入 PIL

file = Image.open('/usr/local/Cellar/tesseract/4.1.0/share/tessdata/cap.png')
we_will = pytesseract.image_to_string(file)
print(we_will)

输出的所有内容是:

Process finished with exit code 0

这是没有帮助的。 我究竟做错了什么?

听起来像we_will是空字符串。 尝试打印repr(we_will)以更清楚地理解这个想法。

IIRC,PyTesseract 在无法弄清楚图像中的文本时会执行此操作。 对于具有单色背景的裁剪图像,您可以获得最佳效果。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM