Class

MPSImageDilate

A filter that finds the maximum pixel value in a rectangular region centered around each pixel in the source image.

Declaration

class MPSImageDilate : MPSUnaryImageKernel

Overview

An MPSImageDilate filter behaves like the MPSImageAreaMax filter, except that the intensity at each position is calculated relative to a different value before determining which is the maximum pixel value, allowing for shaped, non-rectangular morphological probes.

Listing 1 shows pseudocode for the calculation used to return each pixel value.

Listing 1

MPSImageDilate Pseudocode

for each pixel in the filter window
    value = pixel[filterY][filterX] - filter[filterY*filter_width+filterX]
    if( value > bestValue ){
        result = value
        bestValue = value
    }

A filter that contains all zeros is identical to an MPSImageAreaMax filter. The center filter element is assumed to be 0 to avoid causing a general darkening of the image. The edgeMode property value is assumed to always be MPSImageEdgeMode.clamp for this filter.

Topics

Methods

init(device: MTLDevice, kernelWidth: Int, kernelHeight: Int, values: UnsafePointer<Float>)

Initializes the kernel with a specified width, height, and weight values.

Properties

var kernelHeight: Int

The height of the filter window. which must be an odd number.

var kernelWidth: Int

The width of the filter window which must be an odd number.

Relationships

Inherits From

Conforms To

See Also

Morphological Image Filters

class MPSImageAreaMax

A filter that finds the maximum pixel value in a rectangular region centered around each pixel in the source image.

class MPSImageAreaMin

A filter that finds the minimum pixel value in a rectangular region centered around each pixel in the source image.

class MPSImageErode

A filter that finds the minimum pixel value in a rectangular region centered around each pixel in the source image.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software