婷婷综合国产,91蜜桃婷婷狠狠久久综合9色 ,九九九九九精品,国产综合av

主頁(yè) > 知識(shí)庫(kù) > Python實(shí)現(xiàn)OCR識(shí)別之pytesseract案例詳解

Python實(shí)現(xiàn)OCR識(shí)別之pytesseract案例詳解

熱門標(biāo)簽:百應(yīng)電話機(jī)器人總部 成都呼叫中心外呼系統(tǒng)哪家強(qiáng) 無(wú)錫智能外呼系統(tǒng)好用嗎 宿州電話機(jī)器人哪家好 南昌地圖標(biāo)注 地圖標(biāo)注與注銷 旅游廁所地圖標(biāo)注怎么弄 電梯新時(shí)達(dá)系統(tǒng)外呼顯示e 西青語(yǔ)音電銷機(jī)器人哪家好

Python實(shí)現(xiàn)OCR識(shí)別:pytesseract

Python常用pytesseract進(jìn)行圖片上的文字識(shí)別,即OCR識(shí)別,完整的代碼比較簡(jiǎn)單,只要下面一行即可,但是實(shí)際使用時(shí)環(huán)境配置上容易出錯(cuò)。

from PIL import Image
import pytesseract
 
text = pytesseract.image_to_string(Image.open('/Users/alice/Documents/Develop/PythonCode/textinphoto.PNG'))
print(text)

因此使用前,需要先安裝pillow和pytesseract依賴包。

然而運(yùn)行時(shí)仍然報(bào)錯(cuò),raise TesseractNotFoundError()
pytesseract.pytesseract.TesseractNotFoundError: tesseract is not installed or it's not in your path

原因是因?yàn)槲窗惭btesseract,然后使用pip3 install tesseract之后仍然提示錯(cuò)誤,如圖:

alicedembp:~ alice$ pip3 install tesseract
Requirement already satisfied: tesseract in /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages (0.1.3)
alicedembp:~ alice$ tesseract
-bash: tesseract: command not found

無(wú)法使用,往上找了很多教程,說(shuō)是要使用brew安裝,于是得以解決,步驟為:

  • 先安裝brew
alicedembp:~ alice$ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
  • 再使用brew安裝leptonica
alicedembp:~ alice$ brew install leptonica
  • 使用brew安裝tesseract
alicedembp:~ alice$ brew install tesseract
  • 安裝成功,通過(guò)命令行tesseract -v的方式查看是否成功,出現(xiàn)版本號(hào)則為安裝成功
alicedembp:~ alice$ tesseract
Usage:
  tesseract --help | --help-extra | --version
  tesseract --list-langs
  tesseract imagename outputbase [options...] [configfile...]
 
OCR options:
  -l LANG[+LANG]        Specify language(s) used for OCR.
NOTE: These options must occur before any configfile.
 
Single options:
  --help                Show this help message.
  --help-extra          Show extra help for advanced users.
  --version             Show version information.
  --list-langs          List available languages for tesseract engine.
 
alicedembp:~ alice$ tesseract -v
tesseract 4.0.0
 leptonica-1.78.0
  libgif 5.1.4 : libjpeg 9c : libpng 1.6.36 : libtiff 4.0.10 : zlib 1.2.11 : libwebp 1.0.2 : libopenjp2 2.3.1
 Found AVX2
 Found AVX
 Found SSE

接下來(lái)就可以直接使用了,使用如下代碼:

alicedembp:~ alice$ tesseract /Users/alice/Documents/Develop/PythonCode/textinphoto.png /Users/alice/Documents/Develop/PythonCode/output.txt

打開(kāi)textinphoto.PNG的圖片,將文字輸出到output.txt,圖片如下

運(yùn)行成功,產(chǎn)生output.txt文檔,里面的文本為圖片中識(shí)別出的文字。

到此這篇關(guān)于Python實(shí)現(xiàn)OCR識(shí)別之pytesseract案例詳解的文章就介紹到這了,更多相關(guān)python OCR識(shí)別之pytesseract內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!

您可能感興趣的文章:
  • python3使用Pillow、tesseract-ocr與pytesseract模塊的圖片識(shí)別的方法
  • python3光學(xué)字符識(shí)別模塊tesserocr與pytesseract的使用詳解
  • python PaddleOCR庫(kù)用法及知識(shí)點(diǎn)詳解
  • python EasyOCR庫(kù)實(shí)例用法介紹
  • python muggle_ocr庫(kù)用法及實(shí)例代碼
  • python 如何做一個(gè)識(shí)別率百分百的OCR
  • Python 實(shí)現(xiàn)任意區(qū)域文字識(shí)別(OCR)操作

標(biāo)簽:雅安 濰坊 渭南 贛州 西安 七臺(tái)河 許昌 辛集

巨人網(wǎng)絡(luò)通訊聲明:本文標(biāo)題《Python實(shí)現(xiàn)OCR識(shí)別之pytesseract案例詳解》,本文關(guān)鍵詞  Python,實(shí)現(xiàn),OCR,識(shí)別,之,pytesseract,;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問(wèn)題,煩請(qǐng)?zhí)峁┫嚓P(guān)信息告之我們,我們將及時(shí)溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無(wú)關(guān)。
  • 相關(guān)文章
  • 下面列出與本文章《Python實(shí)現(xiàn)OCR識(shí)別之pytesseract案例詳解》相關(guān)的同類信息!
  • 本頁(yè)收集關(guān)于Python實(shí)現(xiàn)OCR識(shí)別之pytesseract案例詳解的相關(guān)信息資訊供網(wǎng)民參考!
  • 推薦文章
    主站蜘蛛池模板: 城口县| 桐城市| 龙里县| 延川县| 铅山县| 历史| 淮南市| 麻阳| 即墨市| 长治县| 民权县| 宜宾市| 尖扎县| 双城市| 志丹县| 陇西县| 吐鲁番市| 开原市| 泰兴市| 连江县| 霞浦县| 锡林郭勒盟| 濮阳县| 疏勒县| 九台市| 绵阳市| 屏边| 库尔勒市| 衡水市| 遵义市| 兰西县| 苗栗县| 新和县| 巴彦县| 资中县| 古交市| 台东县| 柳河县| 富源县| 准格尔旗| 怀安县|