1-pip install tesseract
2-pip install pytesseract
3-pip install pillow
4-brew install tesseract-ocr
eg:
path='test.png'
im=Image.open(path)
# im.load()
# im.show()
print(pytesseract.image_to_string(im))
本文介绍如何使用Tesseract OCR进行图片到文字的转换,并提供了一步一步的安装指导及示例代码。通过pip安装必要的库,如tesseract, pytesseract和Pillow等,再通过Brew安装Tesseract-OCR,最后利用Python读取图片并转换为文字。
1-pip install tesseract
2-pip install pytesseract
3-pip install pillow
4-brew install tesseract-ocr
eg:
path='test.png'
im=Image.open(path)
# im.load()
# im.show()
print(pytesseract.image_to_string(im))
1224
1355