Mac上安装tesseract-OCR

安装homebrew

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

安装完后进行测试

brew -v

返回结果

Homebrew 2.1.1-38-ge68fc53
Homebrew/homebrew-core (git revision 4465d; last commit 2019-04-22)
Homebrew/homebrew-cask (git revision f909; last commit 2019-04-20)

安装tesseract

brew install tesseract

安装完成后进行测试

tesseract -v

返回结果

tesseract 4.1.1
leptonica-1.79.0
 libgif 5.2.1 : libjpeg 9d : libpng 1.6.37 : libtiff 4.1.0 : zlib 1.2.5 : libwebp 1.1.0 : libopenjp2 2.3.1

使用python调用使用

import pytesseract
from PIL import Image

img = Image.open("test.png")
text=pytesseract.image_to_string(img)
print(text)
原文地址:https://www.cnblogs.com/hankleo/p/12593689.html