導航:首頁 > 文字圖片 > python識別圖片中文字

python識別圖片中文字

發布時間:2022-08-30 16:48:11

❶ tesseract 訓練字型檔 python 怎麼調用

1、系統環境

OS X 10.7
MacBook Pro(13英寸,2012年初期)
Python 2.7

2、需要軟體包
a、需要安裝PIL以及pytesseract庫

Python-tesseract是一個基於google's Tesseract-OCR的獨立封裝包;
Python-tesseract功能是識別圖片文件中文字,並作為返回參數返回識別結果;
Python-tesseract默認支持tiff、bmp格式圖片,只有在安裝PIL之後,才能支持jpeg、gif、png等其他圖片格式;
Python-tesseract支持python2.5及更高版本;
PIL[Python Imaging Library]來支持更多的圖片格式;
b、需要安裝google tesseract-ocr

執行命令行 tesseract.exe 1.png output -l eng ,可以識別1.png中文字,並把識別結果輸出到output.txt中;
Pytesseract對上述過程進行了二次封裝,自動調用tesseract.exe,並讀取output.txt文件的內容,作為函數的返回值進行返回。

❷ 從圖中提取文字

從圖片中提取文字,使用OCR技術便可以實現了。比如雲脈的文檔識別軟體,只需將圖片導入到系統中,在系統上進行適當的裁切美化,隨後點擊識別,便可以將圖片文字轉化成可編輯的文字信息了。

❸ python有什麼好的本地文字識別

你好,如果是英文的話。你可以用下面的庫。
pytesser,OCR in Python using the Tesseract engine from Google。是谷歌OCR開源項目的一個模塊,可將圖片中的文字轉換成文本(主要是英文)
如果要識別中文還需要下載對應的訓練集:https://github.com/tesseract-ocr/tessdata
,下載」chi_sim.traineddata」,然後到訓練數據集的存放路徑。下面是一個例子的代碼。
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import pytesseract
from PIL import Image

# open image
image = Image.open('test.png')
code = pytesseract.image_to_string(image, lang='chi_sim')
print(code)

❹ python怎麼識別圖片文字

可以調用opencv來進行識別

❺ 圖片裡面的文字能提取出來嗎

圖片中的文字是可以提取出來的,使用ocr文字識別工具便可以了,比如手迅捷辦公官網中有一個ocr文字識別工具,可以幫助到您;

這個ocr尤其適合新手操作,界面簡單明了,可以識別幾十張語音。
ocr文字識別工具是通過光學作用進行圖片文字提取的!

❻ python怎樣調用第三方平台識別驗證碼

一、pytesseract介紹

1、pytesseract說明

pytesseract最新版本0.1.6,網址:h

Python-tesseract is a wrapper for google's Tesseract-OCR
( ht-ocr/ ). It is also useful as a
stand-alone invocation script to tesseract, as it can read all image types
supported by the Python Imaging Library, including jpeg, png, gif, bmp, tiff,
and others, whereas tesseract-ocr by default only supports tiff and bmp.
Additionally, if used as a script, Python-tesseract will print the recognized
text in stead of writing it to a file. Support for confidence estimates and
bounding box data is planned for future releases.

翻譯一下大意:

a、Python-tesseract是一個基於google's Tesseract-OCR的獨立封裝包;

b、Python-tesseract功能是識別圖片文件中文字,並作為返回參數返回識別結果;

c、Python-tesseract默認支持tiff、bmp格式圖片,只有在安裝PIL之後,才能支持jpeg、gif、png等其他圖片格式;

2、pytesseract安裝

INSTALLATION:

Prerequisites:
* Python-tesseract requires python 2.5 or later or python 3.
* You will need the Python Imaging Library (PIL). Under Debian/Ubuntu, this is
the package "python-imaging" or "python3-imaging" for python3.
* Install google tesseract-ocr from hsseract-ocr/ .
You must be able to invoke the tesseract command as "tesseract". If this
isn't the case, for example because tesseract isn't in your PATH, you will
have to change the "tesseract_cmd" variable at the top of 'tesseract.py'.
Under Debian/Ubuntu you can use the package "tesseract-ocr".

Installing via pip:
See the [pytesseract package page](hi/pytesseract)
```
$> sudo pip install pytesseract

翻譯一下:

a、Python-tesseract支持python2.5及更高版本;

b、Python-tesseract需要安裝PIL(Python Imaging Library) ,來支持更多的圖片格式;

c、Python-tesseract需要安裝tesseract-ocr安裝包,具體參看上一篇博文。

綜上,Pytesseract原理:

1、上一篇博文中提到,執行命令行 tesseract.exe 1.png output -l eng ,可以識別1.png中文字,並把識別結果輸出到output.txt中;

2、Pytesseract對上述過程進行了二次封裝,自動調用tesseract.exe,並讀取output.txt文件的內容,作為函數的返回值進行返回。

二、pytesseract使用

USAGE:
```
> try:
> import Image
> except ImportError:
> from PIL import Image
> import pytesseract
> print(pytesseract.image_to_string(Image.open('test.png')))
> print(pytesseract.image_to_string(Image.open('test-european.jpg'),))

可以看到:

1、核心代碼就是image_to_string函數,該函數還支持-l eng 參數,支持-psm 參數。

用法:
image_to_string(Image.open('test.png'),lang="eng" config="-psm 7")

2、pytesseract里調用了image,所以才需要PIL,其實tesseract.exe本身是支持jpeg、png等圖片格式的。

實例代碼,識別某公共網站的驗證碼(大家千萬別干壞事啊,思慮再三,最後還是隱掉網站域名,大家去找別的網站試試吧……):

View Code

❼ python2.7 ocr 文本識別 應該怎麼弄

Python圖片文本識別使用的工具是PIL和pytesser。因為他們使用到很多的python庫文件,為了避免一個個工具的安裝,建議使用pythonxy
pytesser是OCR開源項目的一個模塊,在Python中導入這個模塊即可將圖片中的文字轉換成文本。pytesser調用了tesseract。當在Python中調用pytesser模塊時,pytesser又用tesseract識別圖片中的文字。pytesser的使用步驟如下:

首先,安裝Python2.7版本,這個版本比較穩定,建議使用這個版本。
其次,安裝pythoncv。
然後,安裝PIL工具,pytesser的使用需要PIL庫的支持。
接著下載pytesser
最後,將pytesser解壓,這個是免安裝的,可以將解壓後的文件cut到Python安裝目錄的Lib\site-packages下直接使用,比如我的安裝目錄是:C:\Python27\Lib\site-packages,同時把這個目錄添加到環境變數之中。
完成以上步驟之後,就可以編寫圖片文本識別的Python腳本了。參考腳本如下:
from pytesser import *
import ImageEnhance
image = Image.open('D:\\workspace\\python\\5.png')
#使用ImageEnhance可以增強圖片的識別率
enhancer = ImageEnhance.Contrast(image)
image_enhancer = enhancer.enhance(4)
print image_to_string(image_enhancer)

tesseract是谷歌的一個對圖片進行識別的開源框架,免費使用,現在已經支持中文,而且識別率非常高,這里簡要來個helloworld級別的認識
下載之後進行安裝,不再演示。
在tesseract目錄下,有個tesseract.exe文件,主要調用這個執行文件,用cmd運行到這個目錄下,在這個目錄下同時放置一張需要識別的圖片,這里是123.jpg
然後運行:tesseract 123.jpg result
會把123.jpg自動識別並轉換為txt文件到result.txt
但是此時中文識別不好
然後找到tessdata目錄,把eng.traineddata替換為chi_sim.traineddata,並且把chi_sim.traineddata重命名為eng.traineddata
ok,現在中文識別基本達到90%以上了

❽ python2.7 ocr 文本識別 怎麼弄的啊

《PandaOCR v2.7圖片文字識別》網路網盤資源免費下載:

鏈接: https://pan..com/s/1nsqG9Fs5lLED4mCe798Nfw

?pwd=8bph 提取碼: 8bph

PandaOCR v2.7最新版是一款專注於OCR 文字識別的免費軟體,支持多功能 OCR 識別、即時翻譯和朗讀等。軟體的功能非常的多並且強大,能夠進行截圖內容識別,剪切OCR識別還有各種圖片內容識別,能夠幫助用戶非常快捷方便的將文本,圖紙或者圖片內的文字識別出來給用戶免費使用,這樣就不需要用戶去看著文字一個字一個字的手打出來,非常的節省用戶的工作時間。

❾ python3.5能用的圖片識別庫,可以識別圖片上的英文數字和漢字

先看看你的Visual Studio 14 運行庫(64位的系統X86/X64的最好都裝上)是不是沒有裝,如果沒有安裝的話先裝上;如果已經安裝了的話,修復一下看看。如果還不行的話那就意味著這些庫暫時還不支持Python 3.5.2,還得耐心等待或者使用其他能實現所需要功能的庫。你可以試試下載EXE文件自己安裝,或者下載源碼自己編譯。
我在我的電腦(XP/Python3.4.4)上用pip安裝試了一下,tesseract-ocr安裝不上,其他兩個沒有問題,估計暫時還不支持Python3.X吧。
tesseract-ocr的EXE安裝包下載地址:https://sourceforge.net/projects/tesseract-ocr-alt/files/?source=navbar
我沒有嘗試使用EXE安裝包安裝樓主可以自己嘗試一下。
希望對樓主有幫助。

❿ python解析圖片中的中文亂碼

是不是中文沒有正確解碼啊?如果系統和編輯器是utf8的,那string也要轉成utf8的

閱讀全文

與python識別圖片中文字相關的資料

熱點內容
美術花盆和花的圖片簡單 瀏覽:143
水果怎麼擺好看圖片 瀏覽:536
千與千尋人物圖片大全 瀏覽:241
委屈漫畫圖片女孩 瀏覽:402
背景圖片簡約可愛清新 瀏覽:927
圖片狼抱著一個女孩 瀏覽:170
文檔中圖片如何快捷設置大小 瀏覽:255
貂蟬去衣服圖片大全 瀏覽:91
美女背影高清壁紙圖片全屏 瀏覽:58
圖片如何設置標題 瀏覽:807
漂亮文字動態圖片大全 瀏覽:64
七天打卡表可愛圖片 瀏覽:35
波波頭發型效果圖片 瀏覽:658
圖片插入word中無法選中怎麼辦 瀏覽:219
大叔洗衣服的圖片 瀏覽:444
Word里圖片置頂如何加空格 瀏覽:201
蔣丞圖片高清動漫 瀏覽:302
放美女和平精英圖片 瀏覽:385
黑鼻子可愛圖片 瀏覽:854
word轉換pdf時圖片丟失 瀏覽:290