I have problems with the kernel image. what i am doing is getting the image from the UIImageView and then using some code that i found in the tutorials (i'm new to the main image) but then I want to return the sepia image to the same UIImageView when I ever try to put a new image in the view, which it just disappears, I tested it to see if the image contains an image, but it is not visible. any suggestions on what to do?
EDIT: OK, I got a sepia filter to work, so I tried posterization, and I had the same problem as the image just disappears. Here is the code:
CIImage *beginImage = [CIImage imageWithCGImage:[image_view.image CGImage]];
context = [CIContext contextWithOptions:nil];
filter = [CIFilter filterWithName:@"CIColorPosterize" keysAndValues:kCIInputImageKey, beginImage,@"inputLevels",[NSNumber numberWithFloat:0.8], nil];
CIImage *outputImage = [filter outputImage];
CGImageRef cgimg = [context createCGImage:outputImage fromRect:[outputImage extent]];
UIImage *newImg = [UIImage imageWithCGImage:cgimg];
[image_view setImage:newImg];
CGImageRelease(cgimg);
source
share