【发布时间】:2014-12-13 09:56:01
【问题描述】:
我正在开发一个 OCR 应用程序,它可以读取数字并将它们自动复制到剪贴板,而不是手动输入... 我正在使用 (TesseractOCR) ...但在识别和处理图像之前,我正在改进图像以获得更好的识别。
我使用了 ImageMagick 库,过滤后的图像如下所示:
但是识别的输出是:
446929231986789 //The first and last numbers (4 & 9) were added
所以我只想检测要裁剪的白框...
我知道 OpenCV 可以解决问题,但不幸的是它是 C++ 库,我不会说那种语言 :(
而且我知道 iOS8 有一个新的 CIDetector 类型 Rectangles 但我不想忽略以前的 iOS 版本
我的 IMAGEMAGICK 过滤器代码:
//Starting
MagickWandGenesis();
magick_wand = NewMagickWand();
//Reading the image....
NSString *tempFilePath = //Path of image
// Monochrome image
MagickQuantizeImage(magick_wand,2,GRAYColorspace,1,MagickFalse,MagickFalse);
// Write to temporary file
MagickWriteImage(magick_wand,
[tempFilePath cStringUsingEncoding:NSASCIIStringEncoding]
);
DestroyMagickWand(magick_wand);//Free up memory
// Load UIImage from temporary file
UIImage *imgObj = [UIImage imageWithContentsOfFile:tempFilePath];
// Display on device
非常感谢..
【问题讨论】:
-
这不是 OCV 问题!为什么你用它来标记你的问题?
-
谢谢@Constantine 我已经解决了
标签: ios objective-c image-processing imagemagick