skimage 0.17.2

ParametersReturnsBackRef
median(image, selem=None, out=None, mode='nearest', cval=0.0, behavior='ndimage')

Parameters

image : array-like

Input image.

selem : ndarray, optional

If behavior=='rank' , selem is a 2-D array of 1's and 0's. If behavior=='ndimage' , selem is a N-D array of 1's and 0's with the same number of dimension than image . If None, selem will be a N-D array with 3 elements for each dimension (e.g., vector, square, cube, etc.)

out : ndarray, (same dtype as image), optional

If None, a new array is allocated.

mode : {'reflect', 'constant', 'nearest', 'mirror','‘wrap'}, optional

The mode parameter determines how the array borders are handled, where cval is the value when mode is equal to 'constant'. Default is 'nearest'.

versionadded

mode is used when behavior='ndimage' .

cval : scalar, optional

Value to fill past edges of input if mode is 'constant'. Default is 0.0

versionadded

cval was added in 0.15 is used when behavior='ndimage' .

behavior : {'ndimage', 'rank'}, optional

Either to use the old behavior (i.e., < 0.15) or the new behavior. The old behavior will call the skimage.filters.rank.median . The new behavior will call the scipy.ndimage.median_filter . Default is 'ndimage'.

versionadded

behavior is introduced in 0.15

versionchanged

Default behavior has been changed from 'rank' to 'ndimage'

Returns

out : 2-D array (same dtype as input image)

Output image.

Return local median of an image.

See Also

skimage.filters.rank.median

Rank-based implementation of the median filtering offering more flexibility with additional parameters but dedicated for unsigned integer images.

Examples

This example is valid syntax, but we were not able to check execution
>>> from skimage import data
... from skimage.morphology import disk
... from skimage.filters import median
... img = data.camera()
... med = median(img, disk(5))
See :

Back References

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

skimage.filters._median.median skimage.filters.rank.generic.median

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/filters/_median.py#10
type: <class 'function'>
Commit: