| Products & Services | Solutions | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → Video and Image Processing Blockset |
| Contents | Index |
| Learn more about Video and Image Processing Blockset |
Statistics

Note The 2-D Median block is obsolete. It may be removed in a future version of the Video and Image Processing Blockset software. Use the replacement block Median. |
The 2-D Median block outputs the median value of the M-by-N input matrix.
| Port | Input/Output | Supported Data Types | Complex Values Supported |
|---|---|---|---|
Input | Vector or matrix of intensity values |
| 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.
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 |
|---|---|---|---|
X | X |
| |
X |
|
| |
X | X | X | |
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.
The Main pane of the 2-D Median dialog box appears as shown in the following figure.

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.

Select the rounding mode for fixed-point operations.
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. |
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.
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.
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.
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.
Video and Image Processing Blockset software | |
Video and Image Processing Blockset software | |
Video and Image Processing Blockset software | |
Video and Image Processing Blockset software | |
Video and Image Processing Blockset software | |
Video and Image Processing Blockset software | |
| Maximum | Signal Processing Blockset software |
Signal Processing Blockset software | |
| Minimum | Signal Processing Blockset software |
MATLAB software |
![]() | 2-D Mean (Obsolete) | 2-D Minimum (Obsolete) | ![]() |

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 |