首页 > 解决方案 > Pytesseract OCR

问题描述

这是我第一次编码。我希望得到有关如何从 Image Passport/ID 中提取文本的指导。使用 python-Tesseract OCR,我对 Tesseract 的文档进行了研究,但没有得到足够的解释。

标签: python-3.xpython-tesseract

解决方案


Import PIL and pytesseract

import PIL.Image
import pytesseract

Load your image

my_image = PIL.Image.open("Path/To/My_Image.jpg")

Run tesseract on it

my_image_text = pytesseract.image_to_string(my_image)
print(my_image_text)

推荐阅读