pytesseract利用tesseract进行OCR文字识别。
依赖项
pillow文档及安装
pip install pillowtesseract下载点这儿
tesseract下载并安装完后需要配置系统变量及tesseract变量。1. 配置系统变量
2. 配置tesseract变量
pytesseract文档及安装
pip install pytesseract
OCR使用
- pytesseract使用
from PIL import Image
import pytesseract
pytesseract.pytesseract.tesseract_cmd = n'<full_path_to_your_tesseract_executable>'
# 转成文字
print(pytesseract.image_to_string(Image.open('test.png')))
# 指定语言
print(pytesseract.image_to_string(Image.open('test-european.jpg'), lang="fra'))- tesseract使用
tesseract 图像路径 输出.txt

京公网安备 11010502036488号