简体   繁体   English

CIDetector过滤矩形并获取裁剪的图像

[英]CIDetector to filter rectangle and get cropped image

I have an app which uses Tesseract for OCR. 我有一个将Tesseract用于OCR的应用程序。 Till now I used to have a manual cropping option of image and then pass the cropped image taken from camera to Tesseract. 到现在为止,我一直使用图像的手动裁剪选项,然后将从相机拍摄的裁剪图像传递给Tesseract。 Now in iOS8 there is CIDetector,using that I am detecting rectangle and passing this to tesseract . 现在在iOS8中有一个CIDetector,使用它我可以检测矩形并将其传递给tesseract。

****Problem *** ****问题***

The problem here is when I pass this cropped image to tesseract its not reading image properly. 这里的问题是,当我通过裁剪后的图像进行整形时,无法正确读取图像。

I know the reason for inacurracy with tesseract is the resolution/scale of the cropped image . 我知道tesseract不准确的原因是裁切后的图像的分辨率/比例。

There are couple of things I am unclear about:- 有几件事我不清楚:

  1. The cropped image is CIImage and I converted it to UIImage,when I see the size of that image its very low(320*468) which was not the case im my prev implemetation,camera image used to be more than 3000*2000 in size . 裁剪后的图像是CIImage,我将其转换为UIImage,当我看到该图像的尺寸非常小(320 * 468)时(不是我以前的实现方式),相机图像的尺寸过去通常超过3000 * 2000 。 Is this lossing its scale while conversion from CIImage to UIImage ? 从CIImage转换为UIImage时,这会失去规模吗?

  2. Or is the problem because I am picking the image differently and not taking a picture with camera ? 还是出现问题,因为我以不同的方式拍摄图像而不用相机拍照?

I have followed this link for live detection :- Link 我已经按照此链接进行实时检测:- 链接

本文中提到的检测器不会返回矩形,它会返回4个点,您需要通过CIFilter“ CIPerspectiveCorrection”运行该点,然后tesseract可以使用CIFilter的输出

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM