bundles / skimage 0.26.1rc0.dev0+git20260530.b607368ff / skimage / morphology / extrema / h_maxima
function
skimage.morphology.extrema:h_maxima
source: /dev/scikit-image/src/skimage/morphology/extrema.py :49
Signature
def h_maxima ( image , h , footprint = None ) Summary
Determine all maxima of the image with height >= h.
Extended Summary
The local maxima are defined as connected sets of pixels with equal gray level strictly greater than the gray level of all pixels in direct neighborhood of the set.
A local maximum M of height h is a local maximum for which there is at least one path joining M with an equal or higher local maximum on which the minimal value is f(M) - h (i.e. the values along the path are not decreasing by more than h with respect to the maximum's value) and no path to an equal or higher local maximum for which the minimal value is greater.
The global maxima of the image are also found by this function.
Parameters
image: ndarrayThe input image for which the maxima are to be calculated.
h: unsigned integerThe minimal height of all extracted maxima.
footprint: ndarray, optionalThe neighborhood expressed as an n-D array of 1's and 0's. Default is the ball of radius 1 according to the maximum norm (i.e. a 3x3 square for 2D images, a 3x3x3 cube for 3D images, etc.)
Returns
h_max: ndarrayThe local maxima of height >= h and the global maxima. The resulting image is a binary image, where pixels belonging to the determined maxima take value 1, the others take value 0.
Examples
import numpy as np from skimage.morphology import extrema✓
w = 10 x, y = np.mgrid[0:w,0:w] f = 20 - 0.2*((x - w/2)**2 + (y-w/2)**2) f[2:4,2:4] = 40; f[2:4,7:9] = 60; f[7:9,2:4] = 80; f[7:9,7:9] = 100 f = f.astype(int)✓
maxima = extrema.h_maxima(f, 40)
✓See also
Aliases
-
skimage.morphology.h_maxima