How can you use Core Image filters to adjust contrast or sharpness?
Asked Answered
P

1

5

How do you adjust contrast or sharpness using the Core Image framework? Which filters should be used and why?

Are there any examples which show how to do this?

Paternal answered 14/10, 2011 at 15:42 Comment(0)
W
14

Contrast is easy:

CIFilter * controlsFilter = [CIFilter filterWithName:@"CIColorControls"];
[controlsFilter setValue:myImage forKey:kCIInputImageKey];
[controlsFilter setValue:@(1.5) forKey:@"inputContrast"];//and so on
displayImage = controlsFilter.outputImage; //and do a conversion from CIImage

However, for sharpness, you're out of luck, as that's not included in the filters for iOS 5.0.

Weakfish answered 9/11, 2011 at 6:30 Comment(1)
I had to use [filter setValue:[NSNumber numberWithFloat:1.5] forKey:@"inputContrast"]; instead of [controlsFilter setValue:1.5 forKey:@"inputContrast"];.Depilate

© 2022 - 2024 — McMap. All rights reserved.