Tesseract
Tesseract 是一个 OCR 库,目前由 Google 赞助(Google 也是一家以 OCR 和机器学习技术闻名于世的公司)。Tesseract 是目前公认最优秀、最精确的开源 OCR 系统,除了极高的精确度,Tesseract 也具有很高的灵活性。它可以通过训练识别出任何字体,也可以识别出任何 Unicode 字符。
安装
- sudo apt-get install tesseract-ocr
在python中调用Tesseract
- pip install pytesseract
在终端中
tesseract test.jpg text
在python代码中
from PIL import Image
import pytesseract
file_path = "图片本地地址" #网络图片不知道
#打开图片
img = Image.open(file_path)
#image_to_string把图片转换成字
print(pytesseract.image_to_string(img))
网友评论