Python 使用 pytesseract 识别简单图像中的数字

Python recognize digits in simple image with pytesseract

我正在尝试使用 pytesseract 来识别图像中的数字,如下所示:

我尝试了以下代码

text=pytesseract.image_to_string(img, lang='eng',
                config='--psm 13 --oem 3 -c tessedit_char_whitelist=0123456789')
print(text)

它给了我

"ae"

试过oem=1还是一样

供大家参考我的版本如下:

pytesseract.get_tesseract_version()

LooseVersion ('4.0.0-beta.1')

任何帮助,包括替代库,我们将不胜感激。

这是一个已知问题 - LSTM (4.0) 不支持黑名单和白名单

基本上白名单和黑名单都不行

一条评论指出

ghost commented on Jul 20, 2018

Use --oem 0 or -oem 0 and it works

我无法测试这个 ATM 但值得一试

4.1 版本应该有这个修复