溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊(cè)×
其他方式登錄
點(diǎn)擊 登錄注冊(cè) 即表示同意《億速云用戶(hù)服務(wù)條款》

python pytesseract庫(kù)怎么安裝使用

發(fā)布時(shí)間:2022-05-30 15:55:21 來(lái)源:億速云 閱讀:530 作者:iii 欄目:大數(shù)據(jù)

這篇文章主要介紹了python pytesseract庫(kù)怎么安裝使用的相關(guān)知識(shí),內(nèi)容詳細(xì)易懂,操作簡(jiǎn)單快捷,具有一定借鑒價(jià)值,相信大家閱讀完這篇python pytesseract庫(kù)怎么安裝使用文章都會(huì)有所收獲,下面我們一起來(lái)看看吧。

說(shuō)明

1、pytesseract需要與安裝在本地的tesseract-ocr.exe文件一起使用。

2、需要注意的是,安裝時(shí)必須選擇中文包,默認(rèn)只支持英文識(shí)別。

安裝命令:

pip install pytesseract

實(shí)例

import pytesseract
from PIL import Image
text = pytesseract.image_to_string(Image.open(r"d:\Desktop\39DEE621-40EA-4ad1-90CC-79EB51D39347.png"))
print(text)

識(shí)別結(jié)果輸出:

Using Tesseract OCR with Python
# import the necessary packages
from PIL import Image
import pytesseract
import ergperse
import cv2
import os
 
# construct the argument parse and parse the arguments
ap = argparse.ArgunentParser()
ap.add_argument("-i", "--image", required-True,
help="path to input image to be OCR'd")
ap.add_argument("-p", "--preprocess", typesstr, default="thresh",
helpe"type of preprocessing to be done")
args = vars (ap.parse_args())

關(guān)于“python pytesseract庫(kù)怎么安裝使用”這篇文章的內(nèi)容就介紹到這里,感謝各位的閱讀!相信大家對(duì)“python pytesseract庫(kù)怎么安裝使用”知識(shí)都有一定的了解,大家如果還想學(xué)習(xí)更多知識(shí),歡迎關(guān)注億速云行業(yè)資訊頻道。

向AI問(wèn)一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI