Image.median#

Image.median(**kwargs: Any) generic | ndarray[source]#

Median value of all pixels

Parameters:

kwargs (dict) – additional keyword arguments passed to numpy.nanmedian

Returns:

median value

Example:

>>> from machinevisiontoolbox import Image
>>> img = Image.Read('flowers1.png')
>>> img.median()  # median over all planes
np.float64(92.0)
>>> img.median(axis=(0,1))  # per-plane median
array([ 80., 105.,  85.])

Note

  • The return value type is the same as the image type.

  • NaN values are ignored

  • For axis remember the axes are in NumPy order: 0=rows, 1=columns, 2=planes.

Seealso:

stats hist mean std numpy.nanmedian numnan