Engee documentation

Median Filter

Median filter.

blockType: MedianFilter

Path in the library:

/Signal Operations/Statistics/Median Filter

Description

Block Median Filter calculates the moving median of the input signal on each channel independently over time. The block uses the sliding window method to calculate the sliding median. In this method, a window of a given length is moved through each channel count by count, and the block calculates the median of the data in the window. This block performs median filtering of the input data over time.

Ports

Input

# IN_1 — input data
column vector | vector string | the matrix

Details

The data used by the block to calculate the moving median. The block accepts real or complex multi-channel and multidimensional input data, that is, input data of dimension on , where and .

Data types

Float16, Float32, Float64, Int8, Int16, Int32, Int64, Int128, UInt8, UInt16, UInt32, UInt64, UInt128

Complex numbers support

Yes

Output

# OUT_1 — output of the moving median
column vector | vector string | the matrix

Details

The size of the moving median output corresponds to the size of the input data. The block uses the sliding window method to calculate the sliding median.

Data types

Float64

Complex numbers support

Yes

Parameters

Main

# Window length — sliding window length
Int64 integer

Details

Defines the length of the sliding window in counts.

Default value

5

Program usage name

WindowLength

Tunable

No

Evaluatable

Yes

Algorithms

Sliding window method

Details

In the sliding window method, the output value for each input sample is the median based on the current sample and previous counts, where — this is the length of the window in counts.

To calculate the first output values, when there is not enough data in the window yet, the algorithm fills the window with zeros. For example, to calculate the median value when the second input sample arrives, the algorithm fills the window zeros; thus, the data vector consists of two data samples, followed by zero. This block performs median filtering of input data in real time.

Consider an example of calculating the sliding median of streaming input data using the usage of the sliding window method. The algorithm uses a window of length 4. When each new input sample arrives, a window of the size 4 moves along the sequence of data.

median filter en