ios - 如何设置图像大小以提高 OCR 输出?

标签 ios ocr tesseract

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

以下 Google 图片得到了良好的结果

enter image description here

上图的图像尺寸

这是谷歌图片。大小为543x83。

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

enter image description here

以上图像详细信息。

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

1.如何让上面的实时图像得到好的效果?

2.Tesseract OCR 需要推荐的图像尺寸吗?

最佳答案

我已经使用 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 命令准备的图像:

enter image description here

关于ios - 如何设置图像大小以提高 OCR 输出?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25679219/

相关文章:

ios - DistanceFromLocation错误

python - Keras 中单个输入的多个输出向量

Android Tesseract OCR 与 NDK (c++)

linux - 文本 block 内的 tesseract 整数识别

java - JNA - C 内存错误导致 Java 程序崩溃

ios - [__NSDictionaryI setObject :forKey:]: unrecognized selector sent to instance

ios - iOS 8.1 iPad Air 2-图像加载内存错误

ios - UIImagePickerController 每秒显示一次黑屏

c++ - 如何使用 tesseract 对文档中的多列进行 OCR

ocr - 如何提高OCR准确率?