pytesseract无法从二进制imag中识别数字

2024-06-26 00:03:40 发布

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

我目前面临pytesseract的一个问题,软件无法检测此图像中的数字:

enter image description here

出于某种原因,pytesseract不想识别图像中的数字。有什么建议吗?这是我的密码:

import pytesseract
from PIL import ImageEnhance, ImageFilter, Image

img = r'/content/inv_thresh.png'
​
str = pytesseract.image_to_string(Image.open(img), lang='eng', \
       config='--psm 8 --oem 3 -c tessedit_char_whitelist=0123456789')

它返回一个字符串COTO


Tags: from图像imageimport密码imgpil软件
1条回答
网友
1楼 · 发布于 2024-06-26 00:03:40
  1. 为什么指定 oem 3Default, based on what is available.
  2. 你用哪种型号?哪个tesseract版本
  3. Tesseract期望无伪影的清晰图像提供正确的结果=>;你需要更好的预处理图像

我使用tesseract(4.1/5.0alpha)的TesserData\u最佳模式得到以下结果:

tesseract a9Uq4.png -  psm 8  dpi 70
00308

相关问题 更多 >