I'm looking to apply Median Filter to a UIImage in my iOS application. Due to my company restrictions, i cannot use openGL filters.
Any ideas or current implementations would be very welcomed. Thanks.
Apple's Core Image
framework may be your solution. To be precise, you need a subclass of CIFilter
which implements a median filter. (Guess you would be interested in CIMedianFilter
or have a look at the filter reference)
CIIImage *inputImage = //...
CIFilter *filter = [CIFilter filterWithName:@"CIMedianFilter"];
[filter setDefaults];
[filter setValue:inputImage forKey:@"inputImage"];
CIImage *outputImage = [filter outputImage];
To convert the CIImage
to UIImage
and vice versa:
CIImage *ciImage = [UIImage imageNamed:@"test.png"].CIImage;
UIImage *uiImage = [[UIImage alloc] initWithCIImage:ciImage];