{ } Raw JSON

bundles / skimage 0.26.1rc0.dev0+git20260530.b607368ff / skimage / filters / _median / median

function

skimage.filters._median:median

source: /dev/scikit-image/src/skimage/filters/_median.py :9

Signature

def   median ( image footprint = None out = None mode = nearest cval = 0.0 behavior = ndimage )

Summary

Return local median of an image.

Parameters

image : array-like

Input image.

footprint : ndarray, optional

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

out : ndarray, optional

If None, a new array is allocated. For behavior='ndimage', dtype matches input. For behavior='rank', dtype follows skimage.filters.rank.median.

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'.

cval : scalar, optional

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

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

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

Returns

out : ndarray

Output image. For behavior='ndimage', dtype matches input. For behavior='rank', dtype follows skimage.filters.rank.median.

Examples

import skimage as ski
img = ski.data.camera()
med = ski.filters.median(img, ski.morphology.disk(5))

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.

Aliases

  • skimage.filters.median

Referenced by