2014-09-05 30 views
2

我正在使用Tesseract Library從MRZ(機器可讀區域)圖像讀取信息。我嘗試了一些google images,並且我得到了很好的結果。但是當我去實時圖像時,那就是當從iphone相機捕獲圖像時,我沒有得到好的結果。如何設置圖像大小以改善OCR輸出。

得到了下面的谷歌圖像在上述圖像

enter image description here

圖像尺寸良好的結果是谷歌image.Size是543x83。當我把圖像從iphone

enter image description here

以上的圖像細節

OCR執行較差。從Iphone.Image大小2205x268

1.How捕獲

圖片以獲取上述實時圖像的好成績?

2.是否存在Tesseract OCR所需的推薦圖像尺寸?

回答

2

我已經使用ImageMagick爲這種事情取得了一些成功 - 從here免費並可用於OSX,Windows和Linux。這是很難找到通用的參數,這把擺弄周圍相當數量的:

#!/bin/bash 

# Enhance image as much as possible for Tesseract OCR 
convert input.jpg -normalize \(-clone 0 -colorspace gray -negate -lat 50x50+10% -contrast-stretch 0 -blur 1x65535 -level 50x100% \) -compose copy_opacity -composite -opaque none -background white -adaptive-blur 3 out.jpg 

# OCR the image and cat the results 
tesseract out.jpg p && cat p.txt 

OCR'ed文本輸出:

IDFRADOUEL<<<<<<<<<<<<<<<<<<<<932013 
U506932020438CHRISTIANE<<NI2906209F3 

這是形象,作爲編制上面的OCR命令:

enter image description here

+0

對此有何好運?你很安靜。 – 2014-09-09 10:14:55

+0

沒有Imagemagick,如何使用opencv或任何其他預處理步驟獲得高於輸出。 – balajichinna 2014-09-09 14:03:16