ubuntu中pytesseract 安装与使用示例

1. 安装 tesseract-ocr 包

安装方法: sudo apt-get install tesseract-ocr
ubuntu中pytesseract 安装与使用示例_第1张图片



2. 安装 PIL
PIL(python imaging library)是python中的图像处理库

安装方法: sudo apt-get install python-imaging

ubuntu中pytesseract 安装与使用示例_第2张图片



3. 安装 pytesseract
安装方法: pip install pytesseract

ubuntu中pytesseract 安装与使用示例_第3张图片



4. pytesseract使用示例

新建py文件或者直接在终端中输入以下程序:

import pytesseract
from PIL import Image

img = Image.open("./01.jpg")
code = pytesseract.image_to_string(img)
print code 


01.jpg:



验证:

ubuntu中pytesseract 安装与使用示例_第4张图片



你可能感兴趣的:(深度学习,ubuntu)