Main Content

vision.Median

(To be removed) Find median values in input or sequence of inputs

vision.Median function will be removed in a future release. Use the median and movmedian functions to find median values, instead.

Description

Find the median values in an input or sequence of inputs.

To track a set of points:

  1. Create the vision.Median object and set its properties.

  2. Call the object with arguments, as if it were a function.

To learn more about how System objects work, see What Are System Objects?

Creation

Description

example

medObj = vision.Median returns an object, medObj, that computes the value and index of the maximum elements in an input or a sequence of inputs.

medObj = vision.Median(Name,Value) sets properties using one or more name-value pairs. Enclose each property name in quotes. For example, medObj = vision.Median('Dimension','Column')

Properties

expand all

Unless otherwise indicated, properties are nontunable, which means you cannot change their values after calling the object. Objects lock when you call them, and the release function unlocks them.

If a property is tunable, you can change its value at any time.

For more information on changing property values, see System Design in MATLAB Using System Objects.

Sort method for calculating the median value, specified as 'Quick sort' or 'Insertion sort'.

Dimension to operate along, specified as {'All'}, 'Row', 'Column', or 'Custom'. This property applies only when you set the RunningMean property to false.

Numerical dimension to calculate over, specified as a numerical scalar. This property only applies when you set the Dimension property to 'Custom'.

Fixed-Point Properties

Rounding method for fixed-point operations, specified as 'Floor', 'Ceiling', 'Convergent', 'Nearest' , 'Round' , 'Simplest' , or 'Zero'.

Action to take when integer input is out-of-range, specified as 'Wrap' or 'Saturate'.

Product data type, specified as 'Same as input' or 'Custom'.

Product word and fraction lengths, specified as a scaled numerictype (Fixed-Point Designer) object. This property applies only when you set the AccumulatorDataType property to 'Custom'.

Data type of accumulator, specified as 'Same as product', 'Same as input', or 'Custom'.

Accumulator word and fraction lengths, specified as a scaled numerictype (Fixed-Point Designer) object. This property applies only when you set the AccumulatorDataType property to 'Custom'.

Usage

Description

example

[value,index] = medObj(input) returns the median value and index of the input.

Input Arguments

expand all

Input data, specified as a vector, matrix, or multidimensional array.

Output Arguments

expand all

Median value, returned as the same data type as the input

Object Functions

To use an object function, specify the System object™ as the first input argument. For example, to release system resources of a System object named obj, use this syntax:

release(obj)

expand all

stepRun System object algorithm
releaseRelease resources and allow changes to System object property values and input characteristics
resetReset internal states of System object

Examples

collapse all

  1. Read a color image.

    img = imread('peppers.png');
  2. Convert the image to grayscale.

    img = im2single(rgb2gray(img));
  3. Find the median.

    hmed = vision.Median;
    medValue = hmed(img);

Extended Capabilities

Version History

Introduced in R2012a

collapse all

R2024a: vision.Median function will be removed

vision.Median function will be removed in a future release. Use the median and movmedian functions to find median values, instead.

See Also

|