這篇文章主要介紹了python pytesseract庫怎么安裝使用的相關知識,內容詳細易懂,操作簡單快捷,具有一定借鑒價值,相信大家閱讀完這篇python pytesseract庫怎么安裝使用文章都會有所收獲,下面我們一起來看看吧。
說明
1、pytesseract需要與安裝在本地的tesseract-ocr.exe文件一起使用。
2、需要注意的是,安裝時必須選擇中文包,默認只支持英文識別。
安裝命令:
pip install pytesseract
實例
import pytesseract from PIL import Image text = pytesseract.image_to_string(Image.open(r"d:\Desktop\39DEE621-40EA-4ad1-90CC-79EB51D39347.png")) print(text)
識別結果輸出:
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庫怎么安裝使用”這篇文章的內容就介紹到這里,感謝各位的閱讀!相信大家對“python pytesseract庫怎么安裝使用”知識都有一定的了解,大家如果還想學習更多知識,歡迎關注億速云行業資訊頻道。
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。