使用tesseract-ocr生成訓(xùn)練庫(kù)全部指令

coding:utf-8

import copy
from PIL import Image,ImageEnhance

創(chuàng)新互聯(lián)專(zhuān)注于企業(yè)成都全網(wǎng)營(yíng)銷(xiāo)推廣、網(wǎng)站重做改版、旅順口網(wǎng)站定制設(shè)計(jì)、自適應(yīng)品牌網(wǎng)站建設(shè)、H5高端網(wǎng)站建設(shè)、商城建設(shè)、集團(tuán)公司官網(wǎng)建設(shè)、外貿(mào)網(wǎng)站制作、高端網(wǎng)站制作、響應(yīng)式網(wǎng)頁(yè)設(shè)計(jì)等建站業(yè)務(wù),價(jià)格優(yōu)惠性價(jià)比高,為旅順口等各大城市提供網(wǎng)站開(kāi)發(fā)制作服務(wù)。

im = Image.open('d:/workspace/captcha/0.png')
im = im.convert('RGB')
im4 = Image.open('d:/1.gif')

class ImageSequence:
def init(self, im):
self.im = im
def getitem(self, ix):
try:
if ix:
self.im.seek(ix)
return self.im
except EOFError:
raise IndexError # end of sequence

imS = ImageSequence(im4)

from PIL import ImageDraw,ImageFont
from pytesseract import pytesseract as pt

path = "D:\workspace\captcha\"
img = Image.open(path+"34.png")
img = img.convert("L")
s = pt.image_to_string(img,lang="dt",config="-psm 7")
print(s)

1、合并圖片

2、生成box文件

tesseract dty.dt.exp0.tif dty.dt.exp0 -l eng -psm 7 batch.nochop makebox

3、修改box文件

4、生成font_properties

echo dt 0 0 0 0 0 >font_properties

5、生成訓(xùn)練文件

tesseract dty.dt.exp0.tif dty.dt.exp0 -l eng -psm 7 nobatch box.train

6、生成字符集文件

unicharset_extractor dty.dt.exp0.box

7、生成shape文件

shapeclustering -F font_properties -U unicharset -O dty.unicharset dty.dt.exp0.tr

8、生成聚集字符特征文件

mftraining -F font_properties -U unicharset -O dty.unicharset dty.dt.exp0.tr

9、生成字符正常化特征文件

cntraining dty.dt.exp0.tr

10、更名

rename normproto dt.normproto

rename inttemp dt.inttemp

rename pffmtable dt.pffmtable

rename unicharset dt.unicharset

rename shapetable dt.shapetable

11、合并訓(xùn)練文件,生成dt.traineddata

combine_tessdata dt.

當(dāng)前題目:使用tesseract-ocr生成訓(xùn)練庫(kù)全部指令
標(biāo)題URL:http://muchs.cn/article4/iiopie.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供面包屑導(dǎo)航、Google網(wǎng)站維護(hù)、外貿(mào)建站、網(wǎng)站改版定制開(kāi)發(fā)

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)

成都定制網(wǎng)站建設(shè)