Contents

morphologyRectangleMinimum()

Blurs a rectangular area by reducing contrasting pixels.

Declaration

class func morphologyRectangleMinimum() -> any CIFilter & CIMorphologyRectangleMinimum

Return Value

The blurred image.

Discussion

This method applies the morphology rectangle minimum filter to an image. The effect targets a rectangular 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 reduces the pixels with contrasting colors to take up more of the less area. The effect is then repeated throughout the image.

The morphology rectangle minimum filter uses the following properties:

width

A float representing the width in pixels of the working area as an NSNumber.

height

A float representing the height in pixels of the working area 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 palm trees input image:

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

        let morphologyRectangleMinimumFilter = CIFilter.morphologyRectangleMinimum()
        morphologyRectangleMinimumFilter.inputImage = inputImage
        morphologyRectangleMinimumFilter.width = 5
        morphologyRectangleMinimumFilter.height = 5
        return morphologyRectangleMinimumFilter.outputImage
    }

[Image]

See Also

Filters