Skip to content

Latest commit

 

History

History
34 lines (27 loc) · 1.15 KB

README.md

File metadata and controls

34 lines (27 loc) · 1.15 KB

MedianFilter.jl

This is a simple median filter that resembles Matlabs medfilt1. It is optimized for large windows by utilizing a heap based median calculation.

Usage

The function medfilt1 accepts any Array containing real valued numbers (<:Real) and applies the median filter along the first non singleton dimension.

using MedianFilter

x = randn(Float64, 20)
y = medfilt1(x)

Keyword arguments

Keyword n defines the window length. Default length is 3.

x = randn(Float64, 20)
y = medfilt1(x, n = 5)

Keyword padding defines the handling of endpoint. Default padding is zeropad, which results in all values outside the endpoints to be assumed as 0. Second variant truncate results in a reduction of window length when approaching the endpoints.

x = randn(Float64, 20)
y = medfilt1(x, padding = "truncate")

Keyword dim defines the dimension along which the filter is applied. If not specified the first non singleton dimension gets selected.

x = randn(Float64, (20, 20))
y = medfilt1(x, dim = 2)

Not supported

The Matlab keyword nanflag and therefore handling of missing values is not yet supported.