median()
Calculates the median of an image to refine detail.
Declaration
class func median() -> any CIFilter & CIMedianReturn Value
The blurred image.
Discussion
This method applies the median filter to an image. The effect computes the median value of colors for a group of neighboring pixels and replaces each pixel with calculated data.
The median filter uses the following properties:
- inputImage
A CIImage representing the input image to apply the filter to.
The following code creates a filter that refines the detail in the input image:
func medianBlur(inputImage: CIImage) -> CIImage? {
let medianBlurFilter = CIFilter.median()
medianBlurFilter.inputImage = inputImage
return medianBlurFilter.outputImage
}[Image]