python - pyTesseract 不从图像输出文本
问题描述
也许有人可以帮助我!当我运行以下代码时
从 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 在无法确定图像中的文本时会执行此操作。对于具有单色背景的裁剪图像,您可以获得最佳效果。
推荐阅读
- reactjs - 使用 jest 和 react-testing-library 测试对象属性时出错
- javascript - 检查元素是否具有特定的类 JQUERY
- java - 一个愚蠢的问题:如何在一堆文件中识别一个 jar 文件?
- mysql - 简单的内连接和索引
- postgresql - AWS RDS 实例 PostgreSQL 的 100% CPU 利用率正常使用
- sonarqube - 从 SonarQube_6.7.6 导出报告
- java - Calendar#getFirstDayOfWeek() 返回错误值
- data-binding - 无法在详细信息页面中显示所选第一行的 RowRepeater 的详细信息
- r - 定义生物和技术重复样本的代码(脑筋急转弯)
- image - ASP.NET Core Web API - 保护图像服务