国产成人精品亚洲777人妖,欧美日韩精品一区视频,最新亚洲国产,国产乱码精品一区二区亚洲

您的位置:首頁技術(shù)文章
文章詳情頁

python pytesseract庫的實(shí)例用法

瀏覽:137日期:2022-06-14 18:40:38
說明

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

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

安裝命令

pip install pytesseract實(shí)例

import pytesseractfrom PIL import Imagetext = 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 packagesfrom PIL import Imageimport pytesseractimport ergperseimport cv2import os # construct the argument parse and parse the argumentsap = 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())

實(shí)例擴(kuò)展:

Python使用pytesseract庫識別圖片文字

準(zhǔn)備

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

pip install pytesseract

沒安裝過PIL的也要安裝一下,因?yàn)樗{(diào)用的第一個(gè)參數(shù)是由Image類返回:

pip install PILLOW

實(shí)例

import pytesseractfrom PIL import Imageimg = Image.open('D://aa.jpg')text = pytesseract.image_to_string(img, lang='chi_sim')print(text)

到此這篇關(guān)于python pytesseract庫的實(shí)例用法的文章就介紹到這了,更多相關(guān)python pytesseract庫是什么內(nèi)容請搜索好吧啦網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持好吧啦網(wǎng)!

標(biāo)簽: python pytesseract
主站蜘蛛池模板: 浑源县| 福海县| 泸水县| 二连浩特市| 沁源县| 文登市| 清镇市| 博湖县| 吐鲁番市| 烟台市| 海宁市| 汶上县| 广河县| 临江市| 搜索| 昆山市| 广河县| 宜兰县| 林周县| 永德县| 西充县| 绥化市| 郓城县| 商都县| 闽清县| 马龙县| 阳谷县| 颍上县| 义马市| 连江县| 盘山县| 靖州| 宜良县| 湾仔区| 富民县| 云龙县| 奉节县| 桓台县| 临海市| 榆林市| 东乡族自治县|