CoreImage ios5中的内存问题

时间:2012-01-04 08:24:55

标签: iphone ios ios5

在使用核心图像框架在图像上应用HUE更改时,是否有人知道如何释放内存? 这是我的代码: -

        CIImage *inputImage = [[CIImage alloc] initWithImage:currentImage];
        CIFilter * controlsFilter = [CIFilter filterWithName:@"CIHueAdjust"];
        [controlsFilter setValue:inputImage forKey:kCIInputImageKey];
        [controlsFilter setValue:[NSNumber numberWithFloat:slider.value] forKey:@"inputAngle"];
         CIImage *displayImage = controlsFilter.outputImage;
        UIImage *finalImage = [UIImage imageWithCIImage:displayImage];

        CIContext *context = [CIContext contextWithOptions:nil];
        if (displayImage == nil || finalImage == nil) {
            // We did not get output image. Let's display the original image itself.
            photoEditView.image = currentImage;
        }else {
            // We got output image. Display it.
            photoEditView.image = [UIImage imageWithCGImage:[context createCGImage:displayImage fromRect:displayImage.extent]];
        }
        context = nil;
        [inputImage release];

1 个答案:

答案 0 :(得分:2)

我认为你也需要发布这个:

[context createCGImage:displayImage fromRect:displayImage.extent]

使用CGImageRelease(CGImageRef)方法。