skimage2.morphology.isotropic_dilation#
- skimage2.morphology.isotropic_dilation(image, radius, out=None, spacing=None)[source]#
Return binary morphological dilation of an image.
Compared to the more general
skimage.morphology.dilation(), this function only supports binary inputs and circular footprints. However, it performs typically faster for large (circular) footprints. This works by applying a threshold to the exact Euclidean distance map of the inverted image [1], [2]. The implementation is based on: func:scipy.ndimage.distance_transform_edt.- Parameters:
- imagendarray
Binary input image.
- radiusfloat
The radius of the footprint used for the operation.
- outndarray of bool, optional
The array to store the result of the morphology. If None is passed, a new array will be allocated.
- spacingfloat, or sequence of float, optional
Spacing of elements along each dimension. If a sequence, must be of length equal to the input’s dimension (number of axes). If a single number, this value is used for all axes. If not specified, a grid spacing of unity is implied.
- Returns:
- dilatedndarray of bool
The result of the morphological dilation with values in
[False, True].
References
[1]Cuisenaire, O. and Macq, B., “Fast Euclidean morphological operators using local distance transformation by propagation, and applications,” Image Processing And Its Applications, 1999. Seventh International Conference on (Conf. Publ. No. 465), 1999, pp. 856-860 vol.2. DOI:10.1049/cp:19990446
[2]Ingemar Ragnemalm, Fast erosion and dilation by contour processing and thresholding of distance maps, Pattern Recognition Letters, Volume 13, Issue 3, 1992, Pages 161-166. DOI:10.1016/0167-8655(92)90055-5
Examples
Dilation enlarges bright regions
>>> import numpy as np >>> import _skimage2 as ski2 >>> image = np.array([[0, 0, 0, 0, 0], ... [0, 0, 0, 0, 0], ... [0, 0, 1, 0, 0], ... [0, 0, 1, 1, 0], ... [0, 0, 0, 0, 0]], dtype=bool) >>> result = ski2.morphology.isotropic_dilation(image, radius=1) >>> result.view(np.uint8) array([[0, 0, 0, 0, 0], [0, 0, 1, 0, 0], [0, 1, 1, 1, 0], [0, 1, 1, 1, 1], [0, 0, 1, 1, 0]], dtype=uint8)