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 sample by sample, 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 the selections.

Default value

5

Program usage name

WindowLength

Tunable

No

Evaluatable

Yes

Algorithms

Sliding window method

Details

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

To calculate the first output when there is not enough data in the window yet, the algorithm fills the window with zeros. As an example, to calculate the median value when the second input sample arrives, the algorithm fills the window zeros. Data vector then represents two data samples, followed by zero. This object performs median filtering of the input data over 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. With each incoming input sample, a window of length 4 moves along the data.

movmed slidewin