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技术非常专业,一般多是印刷.打印行 ...
随机推荐
- mysql成绩排名
关于mysql成绩排名,网上大部分只是order by简单排序,忽略了成绩相同并列名次的问题. 定义了一个表score结构为:
- Grunt的使用
在Node环境下.需要预先安装好Node. 1.安装grunt-cli [root@Luxh-01 ~]# npm install -g grunt-cli 2.创建一个目录test [root@Lu ...
- 开源的运维机器人hubot原理
- [翻译练习]密码学1小时入门 (Everything you need to know about cryptography in 1 hour)
原文:http://www.daemonology.net/papers/crypto1hr.pdf [密码学简介] 很多人都误用了密码学 一般可归为三类: 1. 愚蠢 比如Google ...
- 【HEVC】1、HM-16.7编码器的基本结构
编码器在整个HM解决方案中的工程名为TAppEncoder,入口点函数位于encmain.cpp文件中: int main(int argc, char* argv[]) { TAppEncTop c ...
- 【Python】【学习笔记】持续更新
调用模块的两种方式: #方式1 from decimal import Decimal Decimal('1.00') #方式2 import decimal decimal.Decimal('1.0 ...
- Calendar获取星期
Calendar的使用举个小栗子: //通过当前时间获取本周周一时间 Date date = new Date(); Calendar calendar = new GregorianCalendar ...
- NodeJs 创建 Web 服务器
以下是演示一个最基本的 HTTP 服务器架构(使用8081端口),创建 ser.js 文件,代码如下所示: var http = require('http'); var fs = require(' ...
- mongoDB数据库和Spring MVC的整合
之前一直用到的项目是Spring MVC+maven+mysql的,最近有些数据需要用到mongoDB数据库,现在做一些总结. 第一步:加载jar.maven配置 <!-- mongodb开始 ...
- Linux系统启动级别及顺序
Linux系统有7个运行级别(runlevel)运行级别0:系统停机状态,系统默认运行级别不能设为0,否则不能正常启动运行级别1:单用户工作状态,root权限,用于系统维护,禁止远程登陆运行级别2:多 ...