boxBlur()
Applies a square-shaped blur to an area of an image.
Declaration
class func boxBlur() -> any CIFilter & CIBoxBlurReturn Value
The blurred image.
Discussion
This method applies the box blur filter to an image. The effect targets a square area and calculates the median color value of the pixels to create the output image. The radius is the width of a square area with a larger area, resulting in a stronger blur effect on the output image.
The box blur filter uses the following properties:
radiusA
floatrepresenting the area of effect as a NSNumber.inputImageA CIImage representing the input image to apply the filter to.
The following code creates a filter that results in less detail in the input image:
func boxBlur(inputImage: CIImage) -> CIImage? {
let boxBlurFilter = CIFilter.boxBlur()
boxBlurFilter.inputImage = inputImage
boxBlurFilter.radius = 10
return boxBlurFilter.outputImage
}[Image]