Contents

areaMaximum()

Calculates the maximum color components of a specified area of the image.

Declaration

class func areaMaximum() -> any CIFilter & CIAreaMaximum

Return Value

A 1 x 1 size image containing the maximum color components.

Discussion

This filter returns the maximum color components in the region defined by extent.

The area maximum filter uses the following properties:.

inputImage

An image with the type CIImage.

extent

A CGRect that specifies the subregion of the image that you want to process.

The following code creates a filter that calculates the maximum color components of a 500 x 500 set of pixels from the center of the image:

func areaMaximum(inputImage: CIImage) -> CIImage {
    let filter = CIFilter.areaMaximum()
    filter.inputImage = inputImage
    filter.extent = CGRect(
        x: inputImage.extent.width/2,
        y: inputImage.extent.height/2,
        width: 100,
        height: 100)
     return filter.outputImage!
}

[Image]

See Also

Filters