This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

Border Padding for Morphology

Morphological functions position the origin of the structuring element, its center element, over the pixel of interest in the input image. For pixels at the edge of an image, parts of the neighborhood defined by the structuring element can extend past the border of the image.

To process border pixels, the morphological functions assign a value to these undefined pixels, as if the functions had padded the image with additional rows and columns. The value of these padding pixels varies for dilation and erosion operations. The table describes the padding rules for dilation and erosion for both binary and grayscale images.

Rules for Padding Images

Operation

Rule

Dilation

Pixels beyond the image border are assigned the minimum value afforded by the data type.

For binary images, these pixels are assumed to be set to 0. For grayscale images, the minimum value for uint8 images is 0.

Erosion

Pixels beyond the image border are assigned the maximum value afforded by the data type.

For binary images, these pixels are assumed to be set to 1. For grayscale images, the maximum value for uint8 images is 255.

Note

By using the minimum value for dilation operations and the maximum value for erosion operations, the toolbox avoids border effects, where regions near the borders of the output image do not appear to be homogeneous with the rest of the image. For example, if erosion padded with a minimum value, eroding an image would result in a black border around the edge of the output image.

See Also

| | | | |

Related Topics