{ } Raw JSON

bundles / skimage 0.26.1rc0.dev0+git20260530.b607368ff / skimage / morphology / binary / binary_dilation

function

skimage.morphology.binary:binary_dilation

source: /dev/scikit-image/src/skimage/morphology/binary.py :133

Signature

def   binary_dilation ( image footprint = None out = None * mode = ignore )

Summary

Return fast binary morphological dilation of an image.

Extended Summary

This function returns the same result as grayscale dilation but performs faster for binary images.

Morphological dilation sets a pixel at (i,j) to the maximum over all pixels in the neighborhood centered at (i,j). Dilation enlarges bright regions and shrinks dark regions.

Parameters

image : ndarray

Binary input image.

footprint : ndarray or tuple, optional

The neighborhood expressed as a 2-D array of 1's and 0's. If None, use a cross-shaped footprint (connectivity=1). The footprint can also be provided as a sequence of smaller footprints as described in the notes below.

out : ndarray of bool, optional

The array to store the result of the morphology. If None is passed, a new array will be allocated.

mode : str, optional

The mode parameter determines how the array borders are handled. Valid modes are: 'max', 'min', 'ignore'. If 'min' or 'ignore', pixels outside the image domain are assumed to be False, which causes them to not influence the result. Default is 'ignore'.

Returns

dilated : ndarray of bool or uint

The result of the morphological dilation with values in [False, True].

Notes

The footprint can also be a provided as a sequence of 2-tuples where the first element of each 2-tuple is a footprint ndarray and the second element is an integer describing the number of times it should be iterated. For example footprint=[(np.ones((9, 1)), 1), (np.ones((1, 9)), 1)] would apply a 9x1 footprint followed by a 1x9 footprint resulting in a net effect that is the same as footprint=np.ones((9, 9)), but with lower computational cost. Most of the builtin footprints such as skimage.morphology.disk provide an option to automatically generate a footprint sequence of this type.

For non-symmetric footprints, skimage.morphology.binary_dilation and skimage.morphology.dilation produce an output that differs: binary_dilation mirrors the footprint, whereas dilation does not. skimage.morphology.mirror_footprint is available to correct for this.

See also

skimage.morphology.isotropic_dilation

Aliases

  • skimage.morphology.binary_dilation

Referenced by