使用tesseract-ocr生成训练库全部指令-创新互联

coding:utf-8

import copy
from PIL import Image,ImageEnhance

创新互联建站一直通过网站建设和网站营销帮助企业获得更多客户资源。 以"深度挖掘,量身打造,注重实效"的一站式服务,以网站建设、成都网站制作、移动互联产品、全网整合营销推广服务为核心业务。10余年网站制作的经验,使用新网站建设技术,全新开发出的标准网站,不但价格便宜而且实用、灵活,特别适合中小公司网站制作。网站管理系统简单易用,维护方便,您可以完全操作网站资料,是中小公司快速网站建设的选择。

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、生成训练文件

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、合并训练文件,生成dt.traineddata

combine_tessdata dt.

另外有需要云服务器可以了解下创新互联scvps.cn,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。

网页标题:使用tesseract-ocr生成训练库全部指令-创新互联
转载注明:https://www.cdcxhl.com/article30/dpcspo.html

成都网站建设公司_创新互联,为您提供做网站微信小程序网站设计网站策划企业建站定制开发

广告

声明:本网站发布的内容(图片、视频和文字)以用户投稿、用户转载内容为主,如果涉及侵权请尽快告知,我们将会在第一时间删除。文章观点不代表本网站立场,如需处理请联系客服。电话:028-86922220;邮箱:631063699@qq.com。内容未经允许不得转载,或转载时需注明来源: 创新互联

h5响应式网站建设