Products & Services Solutions Academia Support User Community Company

Learn more about Video and Image Processing Blockset   

2-D Median (Obsolete) - Find median value of each input matrix

Library

Statistics

Description

The 2-D Median block outputs the median value of the M-by-N input matrix.

PortInput/OutputSupported Data TypesComplex Values Supported

Input

Vector or matrix of intensity values

  • Double-precision floating point

  • Single-precision floating point

  • Fixed point

  • 8-, 16-, 32-, and 128-bit signed integer

  • 8-, 16-, 32-, and 128-bit unsigned integer

Yes

Output

Median value of each M-by-N input matrix

Same as Input port

Yes

Length-M 1-D vector inputs are treated as M-by-1 column vectors.

When M is odd, the block sorts the column elements by value, and outputs the central row of the sorted matrix.

s = sort(u(:));
y = s((M+1)/2)

When M is even, the block sorts the column elements by value, and outputs the average of the two central rows in the sorted matrix.

s = sort(u(:));
y = mean([s(M/2),s(M/2+1)])

Complex inputs are sorted by magnitude squared. For complex value u = a + bi, the magnitude squared is a2 + b2.

Fixed-Point Data Types

For fixed-point inputs, you can specify accumulator, product output, and output data types as discussed in Dialog Box. Not all these fixed-point parameters are applicable for all types of fixed-point inputs. The following table shows when each kind of data type and scaling is used.

Output Data Type

Accumulator Data Type

Product Output Data Type

Even M

X

X

Odd M

X

Odd M and complex

X

X

X

Even M and complex

X

X

X

The accumulator and output data types and scalings are used for fixed-point signals when M is even. The result of the sum performed while calculating the average of the two central rows of the input matrix is stored in the accumulator data type and scaling. The total result of the average is then put into the output data type and scaling.

The accumulator and product output parameters are used for complex fixed-point inputs. The sum of the squares of the real and imaginary parts of such an input are formed before the input elements are sorted. The results of the squares of the real and imaginary parts are placed into the product output data type and scaling. The result of the sum of the squares is placed into the accumulator data type and scaling.

For fixed-point inputs that are both complex and have even M, the data types are used in all of the ways described. Therefore, in such cases the accumulator type is used in two different ways.

Dialog Box

The Main pane of the 2-D Median dialog box appears as shown in the following figure.

Sort algorithm

Specify whether the elements of the input are sorted using a Quick sort or an Insertion sort algorithm.

The Fixed-point pane of the 2-D Median dialog box appears as shown in the following figure.

Rounding mode

Select the rounding mode for fixed-point operations.

Overflow mode

Select the overflow mode for fixed-point operations.

    Note   The product output, accumulator, and output parameters are only used in certain cases. Refer to Fixed-Point Data Types for more information.

Product output

Use this parameter to specify how to designate the product output word and fraction lengths:

  • When you select Same as input, these characteristics match those of the input to the block.

  • When you select Binary point scaling, you can enter the word length and the fraction length of the product output, in bits.

  • When you select Slope and bias scaling, you can enter the word length, in bits, and the slope of the product output. This block requires power-of-two slope and a bias of 0.

Accumulator

Use this parameter to specify the accumulator word and fraction lengths resulting from a complex-complex multiplication in the block:

  • When you select Same as product output, these characteristics match those of the product output

  • When you select Same as input, these characteristics match those of the input to the block.

  • When you select Binary point scaling, you can enter the word length and the fraction length of the accumulator, in bits.

  • When you select Slope and bias scaling, you can enter the word length, in bits, and the slope of the accumulator. This block requires power-of-two slope and a bias of 0.

Output

Choose how to specify the output word length and fraction length:

  • When you select Same as input, these characteristics match those of the input to the block.

  • When you select Binary point scaling, you can enter the word length and the fraction length of the output, in bits.

  • When you select Slope and bias scaling, you can enter the word length, in bits, and the slope of the output. This block requires power-of-two slope and a bias of 0.

Lock scaling against changes by the autoscaling tool

Select this parameter to prevent any fixed-point scaling you specify in this block mask from being overridden by the autoscaling tool in the Fixed-Point Tool. For more information, see fxptdlg, a reference page on the Fixed-Point Tool in the Simulink documentation.

See Also

2-D Autocorrelation

Video and Image Processing Blockset software

2-D Correlation

Video and Image Processing Blockset software

Histogram

Video and Image Processing Blockset software

Mean

Video and Image Processing Blockset software

Standard Deviation

Video and Image Processing Blockset software

Variance

Video and Image Processing Blockset software

Maximum

Signal Processing Blockset software

Median

Signal Processing Blockset software

Minimum

Signal Processing Blockset software

median

MATLAB software

  


Related Products & Applications

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.

 © 1984-2009- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS