为什么tesseract不接受配置?

时间:2018-05-20 13:09:38

标签: python tesseract python-tesseract

我试图让tesseract只识别数字,但无论我为配置做什么,它都会忽略它。 pytessseract的版本为0.2.0,tesseract的版本为4.00.00alpha

from PIL import Image

import pytesseract as tes
import glob

tes.pytesseract.tesseract_cmd = 'C:/Program Files (x86)/Tesseract-OCR/tesseract'

a = glob.glob(r'C:\Users\Pascal\Desktop\visible\*.png')

for imgPath in a:
    casd = Image.open(imgPath).convert('L').point(lambda x: 0 if x < 200 else 255, '1')
    im = tes.image_to_string(casd, config='outputbase digits')
    print(im)

一些输出:

®a69®0

®a69®0

®ase®0

®aso®0

1 个答案:

答案 0 :(得分:1)

digits配置文件所依赖的功能在Tesseract 4.0x中被破坏。

https://github.com/tesseract-ocr/tesseract/issues/751