【问题标题】:How can I properly detect LetsGoDigital font text?如何正确检测 LetsGoDigital 字体文本?
【发布时间】:2021-04-27 12:51:20
【问题描述】:
【问题讨论】:
标签:
python
python-tesseract
【解决方案1】:
您没有设置任何特定的page segmentation method。我会在这里选择--psm 6:
假设一个统一的文本块。
所以,即使没有进一步的预处理,我也会得到正确的结果:
import cv2
import pytesseract
img = cv2.imread('RcVbM.jpg')
text = pytesseract.image_to_string(img, lang='lets', config='--psm 6')
print(text.replace('\n', '').replace('\f', ''))
# 004200
----------------------------------------
System information
----------------------------------------
Platform: Windows-10-10.0.19041-SP0
Python: 3.9.1
PyCharm: 2021.1.1
OpenCV: 4.5.2
pytesseract: 5.0.0-alpha.20201127
----------------------------------------