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-likeInput image.
footprint: ndarray, optionalIf
behavior='rank',footprintis a 2-D array of 1's and 0's. Ifbehavior='ndimage',footprintis a N-D array of 1's and 0's with the same number of dimensions asimage. If None,footprintwill be a N-D array with 3 elements for each dimension (e.g., vector, square, cube, etc.).out: ndarray, optionalIf None, a new array is allocated. For
behavior='ndimage', dtype matches input. Forbehavior='rank', dtype follows skimage.filters.rank.median.mode: {'reflect', 'constant', 'nearest', 'mirror', 'wrap'}, optionalThe mode parameter determines how the array borders are handled, where
cvalis the value whenmodeis equal to 'constant'. Default is 'nearest'.cval: scalar, optionalValue to fill past edges of input
imageifmodeis 'constant'. Default is 0.0.behavior: {'ndimage', 'rank'}, optionalWhether 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: ndarrayOutput image. For
behavior='ndimage', dtype matches input. Forbehavior='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