【基本用法】
創(chuàng)新互聯(lián)服務(wù)項目包括洛江網(wǎng)站建設(shè)、洛江網(wǎng)站制作、洛江網(wǎng)頁制作以及洛江網(wǎng)絡(luò)營銷策劃等。多年來,我們專注于互聯(lián)網(wǎng)行業(yè),利用自身積累的技術(shù)優(yōu)勢、行業(yè)經(jīng)驗、深度合作伙伴關(guān)系等,向廣大中小型企業(yè)、政府機(jī)構(gòu)等提供互聯(lián)網(wǎng)行業(yè)的解決方案,洛江網(wǎng)站推廣取得了明顯的社會效益與經(jīng)濟(jì)效益。目前,我們服務(wù)的客戶以成都為中心已經(jīng)輻射到洛江省份的部分城市,未來相信會繼續(xù)擴(kuò)大服務(wù)區(qū)域并繼續(xù)獲得客戶的支持與信任!1、tesseract 基本語法:
Usage:tesseract.exe p_w_picpathname outputbase [-l lang] [-psm pagesegmode] [configfile...] pagesegmode values are: 0 = Orientation and script detection (OSD) only. 1 = Automatic page segmentation with OSD. 2 = Automatic page segmentation, but no OSD, or OCR 3 = Fully automatic page segmentation, but no OSD. (Default) 4 = Assume a single column of text of variable sizes. 5 = Assume a single uniform block of vertically aligned text. 6 = Assume a single uniform block of text. 7 = Treat the p_w_picpath as a single text line. 8 = Treat the p_w_picpath as a single word. 9 = Treat the p_w_picpath as a single word in a circle. 10 = Treat the p_w_picpath as a single character. -l lang and/or -psm pagesegmode must occur before anyconfigfile. Single options: -v --version: version info --list-langs: list available languages for tesseract engine tesseract p_w_picpathname outputbase [-l lang] [-psm pagesegmode] [configfile...] tesseract 圖片名 輸出文件名 -l 字庫文件 -psm pagesegmode 配置文件
2、示例:
(1)、
tesseract code.jpg code -l chi_sim -psm 7 digits code 生成code.txt的結(jié)果文件 -l chi_sim 表示用簡體中文字庫 -psm 7 表示告訴tesseract code.jpg圖片是一行文本,默認(rèn)為 3 configfile 參數(shù)值為tessdata\configs 和 tessdata\tessconfigs 目錄下的文件名 digits 內(nèi)容為 tessedit_char_whitelist 0123456789-. 表示數(shù)字
(2)、白名單
tesseract code.jpg code -l eng -psm 7 -c tessedit_char_whitelist="ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
(2)、黑名單
tesseract code.jpg code -l eng -psm 7 -c tessedit_char_blacklist="abcdefghijklmnopqrstuvwxy"
【訓(xùn)練】(以訓(xùn)練arial字體為例)
1、準(zhǔn)備一張字體圖片如下。
2、用 jTessBoxEditor 將圖片轉(zhuǎn)為tif文件,將tif文件命名為 eng.arial.exp0.tif。注意這里其實可以選多張圖片。
Tools -> Merge TIFF...
3、生成坐標(biāo)文件(.box)。
tesseract.exe eng.arial.exp0.tif eng.arial.exp0 batch.nochop makebox
【語法】:tesseract [lang].[fontname].exp[num].tif [lang].[fontname].exp[num] batch.nochop makebox
lang為語言名稱,fontname為字體名稱,num為序號;在tesseract中,一定要注意格式。
4、在當(dāng)前目錄創(chuàng)建 font_properties 文件,內(nèi)容如下。
eng.arial.exp0.box 1 1 1 0 0
【語法】:<fontname> <italic> <bold> <fixed> <serif> <fraktur>
fontname為字體名稱,italic為斜體,bold為黑體字,fixed為默認(rèn)字體,serif為襯線字體,fraktur德文黑字體,1和0代表有和無,精細(xì)區(qū)分時可使用。
5、字符校正。
打開jTessBoxEditor,BOX Editor -> Open,打開 eng.arial.exp0.tif,注意多頁時頁面切換。
6、執(zhí)行批處理文件(arial.bat),生成.traineddata文件。
echo Run Tesseract for Training.. tesseract eng.arial.exp0.tif eng.arial.exp0 nobatch box.train echo Compute the Character Set.. unicharset_extractor eng.arial.exp0.box mftraining -F font_properties -U unicharset -O arial.unicharset eng.arial.exp0.tr echo Clustering.. cntraining eng.arial.exp0.tr echo Rename Files.. rename normproto arial.normproto rename inttemp arial.inttemp rename pffmtable arial.pffmtable rename shapetable arial.shapetable echo Create Tessdata.. combine_tessdata arial. echo. & pause
7、將生成文件中的arial.traineddata 文件拷貝到相應(yīng)tessdata目錄就可以使用啦!
tesseract code.jpg code -l arial
【參考文獻(xiàn)】
1、啥都不懂也能識別驗證碼
2、Tesseract-OCR的簡單使用與訓(xùn)練
3、Adding New Fonts to Tesseract 3 OCR Engine
4、Python做簡單的驗證碼識別(ocr)
*** walker ***
另外有需要云服務(wù)器可以了解下創(chuàng)新互聯(lián)scvps.cn,海內(nèi)外云服務(wù)器15元起步,三天無理由+7*72小時售后在線,公司持有idc許可證,提供“云服務(wù)器、裸金屬服務(wù)器、高防服務(wù)器、香港服務(wù)器、美國服務(wù)器、虛擬主機(jī)、免備案服務(wù)器”等云主機(jī)租用服務(wù)以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡單易用、服務(wù)可用性高、性價比高”等特點與優(yōu)勢,專為企業(yè)上云打造定制,能夠滿足用戶豐富、多元化的應(yīng)用場景需求。
分享標(biāo)題:tesseract-ocrtips-創(chuàng)新互聯(lián)
新聞來源:http://www.yijiale78.com/article2/ceeeic.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站制作、App設(shè)計、定制開發(fā)、微信公眾號、網(wǎng)站內(nèi)鏈、Google
聲明:本網(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)
猜你還喜歡下面的內(nèi)容