OpenCV或PyTesseract是否可以识别字体

时间:2019-06-12 16:01:03

标签: python opencv tesseract python-tesseract

使用以下代码,我可以读取图像中的所有文本:

import cv2
img = cv2.imread(r'/<path_to_image>/text.png')
print(pytesseract.image_to_string(img))

我想知道的是OpenCV或PyTesseract支持基于字体名称的文本提取吗?例如,如果特定文本位于Times New Roman中,而其余文本为Arial,则仅提取Times New Roman。像这样:

print(pytesseract.image_to_string(img, lang='font'))

1 个答案:

答案 0 :(得分:1)

当然没有。 Tesseract几乎无法从6中识别出G,而OpenCV是计算机视觉库。