MedianFilter

MedianFilter[image, r]
filters image by replacing every value by the median in its range-r neighborhood.

MedianFilter[data, r]
applies median filtering to an array of data.

DetailsDetails

  • MedianFilter[image, r] finds the median in × blocks centered on each pixel.
  • At the edges of an image, MedianFilter uses smaller neighborhoods.
  • MedianFilter[image, {r1, r2}] uses neighborhoods with vertical range and horizontal range .
  • For multichannel images, MedianFilter[image, ...] replaces each pixel by a pixel in its neighborhood that has the median total intensity, averaged over all channels.
  • In MedianFilter[data, ...], data can be an array of any rank.

ExamplesExamplesopen allclose all

Basic Examples (4)Basic Examples (4)

Use a median filter to remove smaller stars from an astronomical image:

In[1]:=
Click for copyable input
Out[1]=

Blur an image using median filtering:

In[1]:=
Click for copyable input
Out[1]=

Remove noise from an ultrasound image:

In[1]:=
Click for copyable input
Out[1]=

Median filter of a vector:

In[1]:=
Click for copyable input
Out[1]=
New in 7
New to Mathematica? Find your learning path »
Have a question? Ask support »