Tesseract即使对于高质量的图像也无法识别字符

时间:2014-07-24 08:44:13

标签: image-processing tesseract leptonica

我正在使用leptonica进行清理和图像处理,然后将其传递给tesseract进行OCR。但是,即使图像质量很高,也无法识别字符。图像规格如下。< / p>

1 bpp, uncompressed, 1280 * 960 , 300dpi horizontal and vertical resolution

以下是我使用leptonica

按顺序执行的图像处理操作
pixConvertTo8
pixBackgroundNormSimple
pixOtsuAdaptiveThreshold
pixContrastTRC {Regarding this - I am passing high values like 1.0 or even 5.0 but image doesnt really change}
pixFindSkew
pixRotate { rotate by angle found by pixFindSkew}
pixRotate90 {do this 4 times to read image in all 4 orientations}
pixClipRectangle {crop image}
Finally tesseract command

我在输出中得到垃圾字符。示例输入图像如下。 enter image description here

我得到的输出如下

Final K-1
II]
s h d | K-1 ,.,
(F°o.~?n‘i&1) 5/>.©12 mm E2‘;
Deparlrnenl of tho Treasury , ,
I 1 I l I
‘mama, Ravenuo SGMW For cnlundm your 201), ‘ " °F°$ "'100fTIO
or lax yum boqmnnnq 7 _ 20\Q_
‘ 7660
and ondmg _  W vv I go
Beneï¬ciary's Share of Income, Deductions,
cl'editS, etc. F 800 buck 01 loam nnd lnstruoflons»
___lnformatI0n About mo Estate or Trust
‘ Ordmary d|v|dm
i 12113
 _
‘; Quahfmd dlVIdG
\ 8132
3 1
Net shun-term
A Estate's at trust's omgiuym ldonnlmnluon numbol
56-0987654
B Estate's u trust‘: namo
ESTATE OF MARTHA SMITH
0 Fiduc§ary's name, address, clly, smlu‘ and /IP codo
N01 long~lerm c
\ 24043 
u 
‘ 28% vale gann
Ti
Unreptumd 5
Omar porfloho 4
nonbuslness lfll
/\..4........ L. ._.._ ,.

我该怎么做才能提高准确性。

第2部分:

我试图关注this link。并创建了一个eng.user-words.traineddata文件和bazaar.train文件,并试图以“bazaar”作为附加参数运行。但我得到“read_params_file:不能公开市集错误“。 有什么建议?

2 个答案:

答案 0 :(得分:1)

第一部分,

我不知道你在这里发布的图片是否是你尝试扫描的实际图像,但是当我尝试扫描时,我得到了这个: -


  

财政部国税局部门

     

对于cnlundm你的V019,1''“l0T°5'| nC0m0

     

或者税山药boqlnnlnq,2o12_'7660和ondlng我去2:'普通   dlvndm“”T'x 12113

     

1; Quali?ed dwnda'8132 Netshun-term:

     

M不长〜terrn c

     

我24043 Ab'2896 ralagann

     

Bene?ciary的收入份额,扣除额,Cfedits等.5 800 back oi   形式和指导

     

| Partl有关州或信托的信息

     

A Estate或IvLsl的omuoym Idonnlncnluon numhu

     

56-0987654

     

8 Estate':信托':namo

     

MARTHA SMITH的房产

     

M:Unreptumd 5

     

017161 portioho:nonbuslness Inl

     

CFiduc§ary的名字,地址,城市,smlul an-(V1 / If'Eooo


它不是很好,但它似乎比你得到的好一点。我在Windows上使用Tesseract v3。 我的基本命令是:

-    tesseract.exe  nnm.tif  nnm

第二部分,

您的bazaar文件应位于configs文件夹

 .....\Tesseract-OCR\tessdata\configs\bazaar

并且有一些要求以特定格式保存,例如UTF8只有一行LF而不是CR + LF,它似乎相当关于文件格式的挑剔。

您可以从http://code.metager.de/source/raw/google/tesseract-ocr/tessdata/configs/bazaar

获取该副本

我制作了一个数字配置文件,用于扫描一些我只对数字感兴趣的图像,并且工作正常:

-   tesseract.exe  scanfile.jpg  scanfile  digits 

Tesseract的文档相当差,在PC上运行效果不佳。

答案 1 :(得分:0)

第一部分,

我认为您应该考虑使用Capture2Text进行预处理。它使用Leptonica和Tesseract来对图像进行OCR。

我不确定第2部分。