Contents

morphologyMaximum()

Blurs a circular area by enlarging contrasting pixels.

Declaration

class func morphologyMaximum() -> any CIFilter & CIMorphologyMaximum

Return Value

The blurred image.

Discussion

This method applies the morphology maximum filter to an image. The effect targets a circular section of the image, calculating the median color values to find colors that make up more than half the working area. Using this calculation, the effect enlarges the pixels with contrasting colors to take up more of the working area. The effect is then repeated throughout the image.

The morphology maximum filter uses the following properties:

radius

A float representing the area of effect as an NSNumber.

inputImage

A CIImage representing the input image to apply the filter to.

The following code creates a filter that adds an intense blur to the input image:

    func morphologyMaximum(inputImage: CIImage) -> CIImage? {

        let morphologyMaximumFilter = CIFilter.morphologyMaximum()
        morphologyMaximumFilter.inputImage = inputImage
        morphologyMaximumFilter.radius = 5
        return morphologyMaximumFilter.outputImage
    }

[Image]

See Also

Filters