Class

MPSImageErode

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

Declaration

class MPSImageErode : MPSImageDilate

Overview

An MPSImageErode behaves like the MPSImageAreaMin 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

MPSImageErode Pseudocode

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

The definition of the MPSImageErode filter is different from its vImage counterpart (MPSImageErode_filter_value = 1.0f-vImageErode_filter_value.). This allows MPSImageDilate and MPSImageErode to use the same filter, making open and close operators easier to write.

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

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 MPSImageDilate

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.