请在下面找到一些图片,泰瑟拉克不正确地认识它。在
47被认为是“4]”。在
55被认为是“S55”。在
90被认为是“智商”。在
我觉得这些图像很好,应该很容易被Tesseract识别。但结果却是错误的。我使用的代码如下所示。在
import cv2
import pytesseract
from PIL import Image
import glob
for i in glob.glob('*.png'):
img = cv2.imread(i, 0)
tessdata_dir_config = '--tessdata-dir "C:\Program Files (x86)\Tesseract-OCR\" --psm 10'
result = pytesseract.image_to_string(Image.fromarray(img), config=tessdata_dir_config)
print result
有人知道发生了什么事以及如何提高绩效吗?在
我读android设备屏幕上的文本时遇到了问题。 在一些设备上,其他设备却没有。 我在tesseractdocumentation中发现它与图像dpi有关。在
所以我使用了cv2的resize函数来重新缩放图像。在
现在它可以很好地与所有设备配合使用。在
好吧,我为我的问题找到了答案。看来泰瑟拉克不喜欢粗体字,所以你得稍微腐蚀一下黑体字。但是要注意
cv2.erode
会腐蚀字符的白色部分,所以我们必须使用cv2.dilate
来达到这个目的。在我想看看对这个问题有没有更好的分析。所以我会让它打开一段时间,然后选择最好的答案。在
相关问题 更多 >
编程相关推荐