在我的应用程序中,我正在使用核心图像过滤器下面的代码我用于
我的代码:
- (UIImage*)applyRGBWithRed:(float)red withGreen:(float)green withBlue:(float)blue
{
ciimage=[CIImage imageWithCGImage:self.CGImage];
// Make the filter
CIFilter *colorMatrixFilter = [CIFilter filterWithName:@"CIColorMatrix"]; // 2
[colorMatrixFilter setDefaults]; // 3
[colorMatrixFilter setValue:ciimage forKey:kCIInputImageKey]; // 4
[colorMatrixFilter setValue:[CIVector vectorWithX:red Y:0 Z:0 W:0] forKey:@"inputRVector"]; // 5
[colorMatrixFilter setValue:[CIVector vectorWithX:0 Y:green Z:0 W:0] forKey:@"inputGVector"]; // 6
[colorMatrixFilter setValue:[CIVector vectorWithX:0 Y:0 Z:blue W:0] forKey:@"inputBVector"]; // 7
[colorMatrixFilter setValue:[CIVector vectorWithX:0 Y:0 Z:0 W:1] forKey:@"inputAVector"]; // 8z
// Get the output image recipe
CIImage *outputImage = [colorMatrixFilter outputImage]; // 9
// Create the context and instruct CoreImage to draw the output image recipe into a CGImage
context = [CIContext contextWithOptions:nil];
CGImageRef cgimg = [context createCGImage:outputImage fromRect:[outputImage extent]]; // 10
self.saveImage=[UIImage imageWithCGImage:cgimg];
CGImageRelease(cgimg);
return self.saveImage;
}
当我处理大图像[即大于 1.4 MB 大小] 时,它会发出内存警告并使应用程序崩溃。
为什么会导致崩溃?我该如何处理这种情况?
任何建议或想法都非常值得赞赏。我打了一个多星期……
提前致谢....
在分析器中运行时,它会给出以下输出