pytesseract不检测裁剪的imag

2024-04-25 21:26:34 发布

您现在位置:Python中文网/ 问答频道 /正文

我想让pytesseract得到每个数字的位置。 但是,它似乎不适用于此图像,但适用于原始未剪切的图像。我试过使用psm-13配置,但仍然没有检测到任何东西

d = pytesseract.image_to_string(Image.open('page2crop.jpg'))
print(d)

original imagecropped image


Tags: to图像imagestring数字openjpgprint
1条回答
网友
1楼 · 发布于 2024-04-25 21:26:34

这可能是use pytesseract to recognize text from image的副本。
一些用户提到,投票最高的答案返回空结果。但是,有人报告说下面的解决方案有效。我没有测试过。请检查并留下评论,如果它工作

引用投票数第二的答案

import pytesseract
from PIL import Image
text = pytesseract.image_to_string(Image.open("temp.jpg"), lang='eng',
                        config=' psm 10  oem 3 -c tessedit_char_whitelist=0123456789')

print(text)

相关问题 更多 >