【发布时间】:2021-07-12 23:50:50
【问题描述】:
我有一个简单的 pytesseract 脚本,它在 discord bot 中运行以检测图像中的文本。但是,当给定this image 时,它会返回['ESC es Sum Ls a ns ay', 'on', '', 'Sa eon', '', 'Lape een ne eeren eee eserees', '', 'omeereer ee ate erence ecco at arte', '', 'Ue te eect eet rac contac', '', ' ', '', 'ree Cee ed', 'ema eect eens', '\x0c']
我的代码是
im = cv2.imread(attachment.filename)
config = ('-l eng --oem 1 --psm 3')
text = pytesseract.image_to_string(im, config=config)
text = text.split('\n')
【问题讨论】:
-
尝试反转,使文本在白色背景上显示为黑色。还要去看看 tesseract 提高识别率,因为您可能需要使图像中的字符更大。
标签: python discord.py cv2 image-recognition python-tesseract