I am trying to process an image using Core Image. I created the UIImage category to do this.
I added the QuartzCore and CoreImage structures for the project, imported CoreImage / CoreImage.h and used this code:
CIImage *inputImage = self.CIImage;
CIFilter *exposureAdjustmentFilter = [CIFilter filterWithName:@"CIExposureAdjust"];
[exposureAdjustmentFilter setDefaults];
[exposureAdjustmentFilter setValue:inputImage forKey:@"inputImage"];
[exposureAdjustmentFilter setValue:[NSNumber numberWithFloat:5.0f] forKey:@"inputEV"];
CIImage *outputImage = [exposureAdjustmentFilter valueForKey:@"outputImage"];
CIContext *myContext = [CIContext contextWithOptions:nil];
return [UIImage imageWithCGImage:[myContext createCGImage:outputImage fromRect:outputImage.extent]];
But I got a nil output image from the filter.
I also tried using CIHueAdjust with the same result.
Than you in advance
UPDATE . I have found a solution. It was necessary to add a new CIImage , and not just pass the link to UIImage.CIImage as follows:
CIImage *inputImage = [[CIImage alloc] initWithImage:self];