欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

python識別文字(基于tesseract)代碼實例

 更新時間:2019年08月24日 14:36:46   作者:科技改變未來☆  
這篇文章主要介紹了python識別文字(基于tesseract)代碼實例,文中通過示例代碼介紹的非常詳細,對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友可以參考下

這篇文章主要介紹了python識別文字(基于tesseract)代碼實例,文中通過示例代碼介紹的非常詳細,對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友可以參考下

Ubuntu版本:

1.tesseract-ocr安裝

sudo apt-get install tesseract-ocr

2.pytesseract安裝

sudo pip install pytesseract

3.Pillow 安裝

sudo pip install pillow

開始寫代碼:

from PIL import Image
from pytesseract import pytesseract
image = Image.open('test.png')
code = pytesseract.image_to_string(image,lang='chi_sim')
print(code)

報錯了:

找到路徑,發(fā)現(xiàn)沒有chi_sim.traineddata這個訓(xùn)練包

# 安裝訓(xùn)練數(shù)據(jù)(equ為數(shù)學(xué)公式包)
sudo apt-get install tesseract-ocr-eng tesseract-ocr-chi-sim tesseract-ocr-equ

安裝之后就會有訓(xùn)練包了,可以正常運行。

英文識別正確率較高,中文就比較雞肋了。

以上就是本文的全部內(nèi)容,希望對大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。

相關(guān)文章

最新評論