python的pytesseract庫怎么使用

本篇內(nèi)容介紹了“python的pytesseract庫怎么使用”的有關(guān)知識,在實際案例的操作過程中,不少人都會遇到這樣的困境,接下來就讓小編帶領(lǐng)大家學(xué)習(xí)一下如何處理這些情況吧!希望大家仔細(xì)閱讀,能夠?qū)W有所成!

西鄉(xiāng)網(wǎng)站制作公司哪家好,找創(chuàng)新互聯(lián)!從網(wǎng)頁設(shè)計、網(wǎng)站建設(shè)、微信開發(fā)、APP開發(fā)、成都響應(yīng)式網(wǎng)站建設(shè)公司等網(wǎng)站項目制作,到程序開發(fā),運營維護。創(chuàng)新互聯(lián)從2013年開始到現(xiàn)在10年的時間,我們擁有了豐富的建站經(jīng)驗和運維經(jīng)驗,來保證我們的工作的順利進行。專注于網(wǎng)站建設(shè)就選創(chuàng)新互聯(lián)。

說明

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

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

安裝命令

pip install pytesseract

實例

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

識別結(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())

實例擴展:

Python使用pytesseract庫識別圖片文字

準(zhǔn)備

首先需在本機安裝Tesseract客戶端,然后安裝pytesseract庫:

pip install pytesseract

沒安裝過PIL的也要安裝一下,因為所調(diào)用的第一個參數(shù)是由Image類返回:

pip install PILLOW

實例

import pytesseract
from PIL import Image

img = Image.open("D://aa.jpg")
text = pytesseract.image_to_string(img,)
print(text)

“python的pytesseract庫怎么使用”的內(nèi)容就介紹到這里了,感謝大家的閱讀。如果想了解更多行業(yè)相關(guān)的知識可以關(guān)注創(chuàng)新互聯(lián)網(wǎng)站,小編將為大家輸出更多高質(zhì)量的實用文章!

網(wǎng)站欄目:python的pytesseract庫怎么使用
文章路徑:http://bm7419.com/article36/ijpisg.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供靜態(tài)網(wǎng)站、App開發(fā)、營銷型網(wǎng)站建設(shè)、網(wǎng)站建設(shè)、網(wǎng)站制作關(guān)鍵詞優(yōu)化

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

成都網(wǎng)站建設(shè)