Python实现从图片提取文字

编程学习教程

1.Python3的pillow、pytesseract包   可使用pip install pillow、pip install pytesseract命令安装
识别引擎tesseract-ocr下载安装加入环境变量,下载chi_sim.traineddata放在Tesseract-OCR\tessdata目录下
2.代码

  1. from PIL import Image
  2. import pytesseract
  3. image = Image.open('a20170914155348.jpg')
  4. imtext = pytesseract.image_to_string(image,lang='chi_sim')
  5. print(imtext)

3.效果

猜你喜欢

转载自blog.csdn.net/yedehei_lt/article/details/81148827