This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

vision.Median System object

Package: vision

Find median values in an input


The Median object finds median values in an input.

    Note:   Starting in R2016b, instead of using the step method to perform the operation defined by the System object™, you can call the object with arguments, as if it were a function. For example, y = step(obj,x) and y = obj(x) perform equivalent operations.


H = vision.Median returns a System object, H, that computes the median of the input or a sequence of inputs.

H = vision.Median(Name,Value) returns a median System object, H, with each specified property set to the specified value. You can specify additional name-value pair arguments in any order as (Name1, Value1,...,NameN,ValueN).

Code Generation Support
Supports MATLAB® Function block: Yes
System Objects in MATLAB Code Generation.
Code Generation Support, Usage Notes, and Limitations.



Sort method

Specify the sort method used for calculating the median as Quick sort or Insertion sort.


Dimension with which to operate along

Specify how the calculation is performed over the data as All, Row, Column, or Custom. The default is All


Numerical dimension over which to calculate

Specify the integer dimension of the input signal over which the object calculates the mean. The value of this property cannot exceed the number of dimensions in the input signal. This property only applies when you set the Dimension property to Custom. The default is 1.

 Fixed-Point Properties


cloneCreate median object with same property values
getNumInputsNumber of expected inputs to step method
getNumOutputsNumber of outputs from step method
isLockedLocked status for input attributes and non-tunable properties
release Allow property value and input characteristics changes
stepCompute median of input


Determine the median in a grayscale image.

 img = im2single(rgb2gray(imread('peppers.png')));
 hmdn = vision.Median;
 med = step(hmdn,img);


This object implements the algorithm, inputs, and outputs described on the 2-D Median block reference page. The object properties correspond to the block parameters.

Introduced in R2012a

Was this topic helpful?