Apply a median filter to an image. More...

Modules

 medfilt
 The C++ interface for medfilt.
 
 af_medfilt
 The C interface for medfilt.
 

Detailed Description

Apply a median filter to an image.

Apply a median filter of a given size to an image. A median filter is similar to the arbitrary filter except that instead of a weighted sum, the median value of the pixels covered by the kernel is returned.

For instance, if we apply a median filter to an simple sequential image:

array = array(seq(1,16), 4, 4);
print(a);
//a = 1.0000 5.0000 9.0000 13.0000
// 2.0000 6.0000 10.0000 14.0000
// 3.0000 7.0000 11.0000 15.0000
// 4.0000 8.0000 12.0000 16.0000
print(medfilt(a, 3, 3));
// 0.0000 2.0000 6.0000 0.0000
// 2.0000 6.0000 10.0000 10.0000
// 3.0000 7.0000 11.0000 11.0000
// 0.0000 4.0000 8.0000 0.0000

This example highlights that pixels outside the image are treated as zeros. So, for the first pixel, the neighborhood looks like:

0 0 0
0 1 5
0 2 6

the median of which is zero.