Skip to content

mapi1/MedianFilter.jl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

Simple median filter resembling Matlabs medfilt1 function.

Resources

License

Stars

1 star

Watchers

1 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages