【问题标题】:How to set Image size for Improving OCR output.?如何设置图像大小以改善 OCR 输出。?
【发布时间】:2014-10-30 00:20:25
【问题描述】:

我正在使用 Tesseract 库从 MRZ(机器可读区)图像中读取信息。我尝试了一些 google images 并得到了很好的结果。但是当我查看实时图像时,即从 iphone 捕获图像时相机,我没有得到好的结果。

以下谷歌图片取得了不错的效果

上图的图片尺寸

这是谷歌图片。尺寸为 543x83。

当我从 iphone 拍摄图像时,OCR 表现不佳

以上图片详情。

从 Iphone 捕获的图像。图像大小 2205x268

1.上述实时图像如何获得好的效果?

2. Tesseract OCR 是否需要任何推荐的图像尺寸?

【问题讨论】:

    标签: ios ocr tesseract


    【解决方案1】:

    我已经使用 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 文本输出:

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

    这是由上述 OCR 命令准备的图像:

    【讨论】:

    • 这个运气好吗?你很安静。
    • 如果没有 Imagemagick,如何使用 opencv 或任何其他预处理步骤获得以上输出。?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-04-22
    • 2019-01-28
    • 2020-08-29
    • 2015-06-04
    • 1970-01-01
    相关资源
    最近更新 更多