skimage 0.17.2

ParametersReturnsBackRef
h_maxima(image, h, selem=None)

The local maxima are defined as connected sets of pixels with equal grey level strictly greater than the grey 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 a higher 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 for which the minimal value is greater.

Parameters

image : ndarray

The input image for which the maxima are to be calculated.

h : unsigned integer

The minimal height of all extracted maxima.

selem : ndarray, optional

The 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 : ndarray

The maxima of height >= h. The resulting image is a binary image, where pixels belonging to the selected maxima take value 1, the others take value 0.

Determine all maxima of the image with height >= h.

See Also

skimage.morphology.extrema.h_minima
skimage.morphology.extrema.local_maxima
skimage.morphology.extrema.local_minima

Examples

This example is valid syntax, but we were not able to check execution
>>> import numpy as np
... from skimage.morphology import extrema

We create an image (quadratic function with a maximum in the center and 4 additional constant maxima. The heights of the maxima are: 1, 21, 41, 61, 81

This example is valid syntax, but we were not able to check execution
>>> 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(np.int)

We can calculate all maxima with a height of at least 40:

This example is valid syntax, but we were not able to check execution
>>> maxima = extrema.h_maxima(f, 40)

The resulting image will contain 3 local maxima.

See :

Back References

The following pages refer to to this document either explicitly or contain code examples using this.

skimage.morphology.extrema.local_maxima skimage.morphology.extrema.h_minima skimage.morphology.extrema.h_maxima skimage.morphology.extrema.local_minima

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


File: /skimage/morphology/extrema.py#48
type: <class 'function'>
Commit: