MPSImageDilate
A filter that finds the maximum pixel value in a rectangular region by applying a dilation function.
Declaration
class MPSImageDilateOverview
An MPSImageDilate filter behaves like the MPSImageAreaMax filter, except Metal calculates the intensity at each position relative to a different value before determining which is the maximum pixel value, allowing for shaped, nonrectangular morphological probes.
The code example below shows pseudocode for the calculation that returns each pixel value:
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. Metal handles the center filter element as 0 to avoid causing a general darkening of the image, and it handles the edgeMode property as MPSImageEdgeMode.clamp for this filter.