skimage2.morphology.binary_closing#
- skimage2.morphology.binary_closing(image, footprint=None, out=None, *, mode='ignore')[source]#
Return fast binary morphological closing of an image.
Deprecated since version 0.26:
binary_closingis deprecated since version 0.26 and will be removed in version 0.28. Useskimage.morphology.closinginstead.This function returns the same result as grayscale closing but performs faster for binary images.
The morphological closing on an image is defined as a dilation followed by an erosion. Closing can remove small dark spots (i.e. “pepper”) and connect small bright cracks. This tends to “close” up (dark) gaps between (bright) features.
- Parameters:
- imagendarray
Binary input image.
- footprintndarray 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.
- outndarray of bool, optional
The array to store the result of the morphology. If None, is passed, a new array will be allocated.
- modestr, optional
The
modeparameter determines how the array borders are handled. Valid modes are: ‘max’, ‘min’, ‘ignore’. If ‘ignore’, pixels outside the image domain are assumed to beTruefor the erosion andFalsefor the dilation, which causes them to not influence the result. Default is ‘ignore’.Added in version 0.23:
modewas added in 0.23.
- Returns:
- closingndarray of bool
The result of the morphological closing.
See also
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 asfootprint=np.ones((9, 9)), but with lower computational cost. Most of the builtin footprints such asskimage.morphology.disk()provide an option to automatically generate a footprint sequence of this type.