tesseract-ocr
tesseract-ocr 第一课
1.下载地址:
tess-two的构建:
git clone git://github.com/rmtheis/tess-two tess
cd tess
cd tess-two
ndk-build
android update project --path .
ant release
eys-two的构建:
cd ..
cd eyes-two
ndk-build
android update project --path .
ant release

- tessdata/eng.config
- tessdata/eng.unicharset
- tessdata/eng.unicharambigs
- tessdata/eng.inttemp
- tessdata/eng.pffmtable
- tessdata/eng.normproto
- tessdata/eng.punc-dawg
- tessdata/eng.word-dawg
- tessdata/eng.number-dawg
- tessdata/eng.freq-dawg
- ASCII 或者 utf8 编码,没有BOM
- uinx行结尾符('\n')
- 文件尾空行(否则:将得到错误信息:last_char == '\n':Error:Assert failed..)
- 确保每个字符的最小数目的样本。10很好,但5只对少数字符有效。
- 常用字符的样本应更多:至少20个。
- 不要将所有非字母组合在一起。让文件更实际化。例如,“The quick brown fox jumps over the lazy dog. 0123456789 !@#$%^&(),.{}<>/?”,这个就很糟糕。而这个则更好:“The (quick) brown {fox} jumps! over the $3,456.78<lazy> #90 dog & duck/goose, as 12.5% of E-mail from aspammer@website.com is spam?” ,这个给出了文本行查找码,来获取特定字符的基标语义。
- 当打印时,文本空格绝对安全。。。。。。
- 训练数据应该按字体分组。。。。。
- 没必要训练多个size的文本。。。。。
- 不要在一个image文件混合多种字体(确切的说:在单个.tr文件中),它将造成丢弃一些特征,导致识别错误
- 下载页的boxtiff文件将帮助你如何格式化你的训练数据。
tesseract [lang].[fontname].exp[num].tif [lang].[fontname].exp[num] batch.nochop makebox
tesseract eng.timesitalic.exp0.tif eng.timesitalic.exp0 batch.nochop makebox
s 734 494 751 519 0
p 753 486 776 518 0
r 779 494 796 518 0
i 799 494 810 527 0
n 814 494 837 518 0
g 839 485 862 518 0
t 865 492 878 521 0
u 101 453 122 484 0
b 126 453 146 486 0
e 149 452 168 477 0
r 172 453 187 476 0
d 211 451 232 484 0
e 236 451 255 475 0
n 259 452 281 475 0
D 101 504 131 535 0
e 135 502 154 528 0
r 158 503 173 526 0
, 197 498 206 510 0
, 206 497 214 509 0
s 220 501 236 526 0
c 239 501 258 525 0
h 262 502 284 534 0
n 288 501 310 525 0
e 313 500 332 524 0
l 336 501 347 534 0
l 352 500 363 532 0
e 367 499 386 524 0
” 389 520 407 532 0
- 第一个数(左)采用两行中最小的(197)
- 第二个数(下)采用两行中最小的(496)
- 第三个数(右)采用两行中最大的(214)
- 第四个数(上)采用两行中最大的(508)
D 101 504 131 535 0
e 135 502 154 528 0
r 158 503 173 526 0
? 197 497 214 510 0
s 220 501 236 526 0
c 239 501 258 525 0
h 262 502 284 534 0
n 288 501 310 525 0
e 313 500 332 524 0
l 336 501 347 534 0
l 352 500 363 532 0
e 367 499 386 524 0
” 389 520 407 532 0
tesseract fontfile.tif fontfile -l yournewlanguage batch.nochop makebox
- 过滤box文件,只保持你想要的字符。
- 运行tesseract来训练。
- 对于每种字体,从多个语言中cat出.tr文件,来获取你想要的字符休,并从你有的字体或字符中添加.tr文件
- 以相同的方式cat出已经过滤的box文件到.tr文件中,以便在unicharset_extractor中处理
- 运行训练过程的其它步骤
tesseract fontfile.tif junk nobatch box.train
tesseract fontfile.tif junk nobatch box.train.stderr
Every character in the box file has a corresponding set of entries in
the .tr file (in order) like this
UnknownFont <utf8 code(s)> 2
mf <number of features>
x y length dir 0 0
... (there are a set of these determined by <number of features>
above)
cn 1
ypos length x2ndmoment y2ndmoment The mf features are polygon segments of the outline normalized to the
1st and 2nd moments.
x= x position [-0.5.0.5]
y = y position [-0.25, 0.75]
length is the length of the polygon segment [0,1.0]
dir is the direction of the segment [0,1.0] The cn feature is to correct for the moment normalization to
distinguish position and size (eg c vs C and , vs ')
unicharset_extractor fontfile_1.box fontfile_2.box ...
- ';' 为非字母字符,小写字符,大小字符,而非数字。它的属性通过二进制数 10000表示(16进制的10表示 )
- 'b'是一个字母字符,小写字符。它的属性通过二进制数00011表示(3)
- 'W'是一个字母字符,大写字符。它的属性通过二进制数00101表示(5)
- '7'只是一个数字。它的属性通过二进制数01000表示(8)
- ‘=’非数字或字母字符。它的属性通过二进制数字00000表示(0)
; 10 Common 46
b 3 Latin 59
W 5 Latin 40
7 8 Common 66
= 0 Common 93
<fontname> <italic> <bold> <fixed> <serif> <fraktur>
timesitalic 1 0 0 1 0
shapeclustering -F font_properties -U unicharset eng.timesitalic.exp0.tr
mftraining -F font_properties -U unicharset -O eng.unicharset eng.timesitalic.exp0.tr
shapeclustering -F font_properties -U unicharset lang.fontname.exp0.tr lang.fontname.exp1.tr ...
mftraining -F font_properties -U unicharset -O lang.unicharset lang.fontname.exp0.tr lang.fontname.exp1.tr ...
cntraining lang.fontname.exp0.tr lang.fontname.exp1.tr ...
| Name | Type | Description |
| punc-dawg | dawg | A dawg made from punctuation patterns found around words. The "word" part is replaced by a single space. |
| word-dawg | dawg | A dawg made from dictionary words from the language. |
| number-dawg | dawg | A dawg made from tokens which originally contained digits. Each digit is replaced by a space character. |
| freq-dawg | dawg | A dawg made from the most frequent words which would have gone into word-dawg. |
| fixed-length-dawgs | dawg | Several dawgs of different fixed lengths —— useful for languages like Chinese. |
| bigram-dawg | dawg | A dawg of word bigrams where the words are separated by a space and each digit is replaced by a ?. |
| unambig-dawg | dawg | TODO: Describe. |
wordlist2dawg frequent_words_list lang.freq-dawg lang.unicharset
wordlist2dawg words_list lang.word-dawg lang.unicharset
v1
3 I I 0 2 u o 3
3 I - I 1 H 2
2 ' ' 1 " 1
2 ?? 6 1 ?? 1
1 m 2 r n 0
3 i i i 1 m 0
| Value | Type | Description |
| 0 | NOT_AMBIG | the ngram pair is not ambiguous |
| 1 | REPLACE_AMBIG | ocred ngram should always be substituted with correct |
| 2 | DEFINITE_AMBIG | add correct ngram to the classifier results (1-1) |
| 3 | SIMILAR_AMBIG | use pairwise classifier for ocred/correct pair (1-1) |
| 4 | CASE_AMBIG | this is a case ambiguity (1-1) |
combine_tessdata lang.
tesseract image.tif output -l lang
- ambiguous_words
- cntraining
- combine_tessdata
- dawg2wordlist
- mftraining
- shapeclustering
- tesseract
- unicharset_extractor
- wordlist2dawg
tesseract-ocr的更多相关文章
- tesseract ocr文字识别Android实例程序和训练工具全部源代码
tesseract ocr是一个开源的文字识别引擎,Android系统中也可以使用.可以识别50多种语言,通过自己训练识别库的方式,可以大大提高识别的准确率. 为了节省大家的学习时间,现将自己近期的学 ...
- Tesseract——OCR图像识别 入门篇
Tesseract——OCR图像识别 入门篇 最近给了我一个任务,让我研究图像识别,从我们项目的screenshot中识别文字信息,so我开始了学习,与大家分享下. 我看到目前OCR技术有很多,最主要 ...
- Tesseract Ocr引擎
Tesseract Ocr引擎 1.Tesseract介绍 tesseract 是一个google支持的开源ocr项目,其项目地址:https://github.com/tesseract-ocr/t ...
- 开源图片文字识别引擎——Tesseract OCR
Tessseract为一款开源.免费的OCR引擎,能够支持中文十分难得.虽然其识别效果不是很理想,但是对于要求不高的中小型项目来说,已经足够用了. 文字识别可应用于许多领域,如阅读.翻译.文献资料的检 ...
- Python下Tesseract Ocr引擎及安装介绍
1.Tesseract介绍 tesseract 是一个google支持的开源ocr项目,其项目地址:https://github.com/tesseract-ocr/tesseract,目前最新的源码 ...
- Tesseract OCR使用介绍
#Tesseract OCR使用介绍 ##目录[TOC] ##下载地址及介绍 官网介绍:http://code.google.com/p/tesseract-ocr/wiki/TrainingTess ...
- selenium使用笔记(二)——Tesseract OCR
在自动化测试过程中我们经常会遇到需要输入验证码的情况,而现在一般以图片验证码居多.通常我们处理这种情况应该用最简单的方式,让开发给个万能验证码或者直接将验证码这个环节跳过.之前在技术交流群里也跟朋友讨 ...
- alfresco install in linux, and integrated with tesseract ocr
本文描述在Linux系统上安装Alfresco的步骤: 1. 下载安装文件:alfresco-community-5.0.d-installer-linux-x64.bin 2. 增加执行权限并执行: ...
- 使用Tesseract OCR识别验证码
1.下载Tessrac OCR,默认安装 2.把验证码code.jpg图片放在D盘 3.打开cmd,进入D盘,输入:tesseract code.jpg result 4.进入D盘,生成了resul ...
- Tesseract ocr 3.02学习记录一
光学字符识别(OCR,Optical Character Recognition)是指对文本资料进行扫描,然后对图像文件进行分析处理,获取文字及版面信息的过程.OCR技术非常专业,一般多是印刷.打印行 ...
随机推荐
- Libevent Not Found Error While Install Tmux
First install libevent using –prefix=$HOME erro:“libevent not found” solve with using this when inst ...
- [转]安装SharePoint 2013时安装AppFabric失败(错误码:1603)
转自:http://blogs.technet.com/b/praveenh/archive/2013/02/22/sharepoint-2013-prerequisites-fails-with-m ...
- [转载]反无人机企业DroneShield利用声音识别侦测无人机
原文:http://www.cnbeta.com/articles/495071.htm 无人机产业正在蓬勃发展,受益的不仅仅是那些生产小型飞行设备的企业.专家估计仅在澳大利亚就有5万架商用无人机以及 ...
- day9-paramiko
一.基于用户名密码认证SSH连接 #!/usr/bin/env python #coding:utf8 import paramiko ssh = paramiko.SSHClient()#创建SSH ...
- Wireshark简易教程
Wireshark是世界上最流行的网络分析工具.这个强大的工具可以捕捉网络中的数据,并为用户提供关于网络和上层协议的各种信息.与很多其他网络工具一样,Wireshark也使用pcap network ...
- LibreOffice 打开中文乱码
From: http://hi.baidu.com/designhouse/item/746130c01f98a42dee4665de 1:文件->打开 2:文件类型:已编码文本
- Python体验(08)-图形界面之工具栏和状态栏
# coding=utf-8 import wx # 导入必须的Python包 class MenuForm(wx.Frame): def OnQuit(self,event): self.Close ...
- JS的多线程
注:以下内容基于IE中GIF的onload事件的基础上,故所有测试IE only 需要用到的几个图片 先看一个简单的事实: 复制代码代码如下: <SCRIPT LANGUAGE="Ja ...
- 对于旅游业的手机app的分析
对旅游行业的手机app的测试及分析 随着收入水平的提高,旅游已成为人们的惯常需求.或是为了增长见闻,感悟人生:又或者是愉悦感情,消闷解愁:还有的是为了体验生活,追求情调,同时锻炼身体.当然,旅游的目的 ...
- 机器学习系列------1. GBDT算法的原理
GBDT算法是一种监督学习算法.监督学习算法需要解决如下两个问题: 1.损失函数尽可能的小,这样使得目标函数能够尽可能的符合样本 2.正则化函数对训练结果进行惩罚,避免过拟合,这样在预测的时候才能够准 ...