tesseract 无法识别一个数字图像

Lui*_*ues 5 tesseract

我正在将 tesseract 与 python 一起使用。它几乎可以识别我所有带有 2 个或更多数字或字符的图像。但是 tesseract 不能识别只有一个数字的图像。我尝试使用命令行,它给了我“空页”作为响应。

我不想用“只有数字”来训练 tesseract,因为我也在识别字符。

问题是什么?

在 tesseract 无法识别的图像下方。

在此处输入图片说明

代码:

 #getPng(pathImg, '3') -> creates the path to the figure.
 pytesseract.image_to_string( Image.open(getPng(pathImg, '3')) 
Run Code Online (Sandbox Code Playgroud)

cec*_*emi 7

如果添加参数,--psm 13它应该可以工作,因为它会将其视为原始文本行,而不会搜索页面和段落。

所以尝试:

pytesseract.image_to_string(PATH, config="--psm 13") 
Run Code Online (Sandbox Code Playgroud)