1

我想识别写在图像中的文本,所以我想要裁剪这个图像以在所需部分上进行处理,而不是在所有图像上。所以知道我该怎么做吗?这是我在图像上使用的代码:

NSString*ret= [self DoProcess:capturedImage];

这是我想裁剪捕获的图像以对其进行处理。

4

1 回答 1

0

您可以为要提取的图像部分定义一个 CGRect ,然后使用以下方法:

CGRect cropRect = ...;
UIImage *cropped = [UIImage imageWithCGImage:CGImageCreateWithImageInRect([fullImage CGImage], cropRect) scale:fullImage.scale orientation:fullImage.imageOrientation];
于 2013-04-09T04:06:22.500 回答