Version française

The Image Processing Corner


Median filter
Previous  Next 

The median filter is a non-linear filter.

Its principle is simple: each pixel is replaced by the median value in a defined neighborhood. For instance, for a 3x3 pixels neighborhood, each color channel of each pixel is replaced by the fifth value among the 9 of the neighborhood sorted in increasing (or decreasing) order

The result of the median filter on a 3x3 neighborhood is illustrated below. The first row gives the input noisy images, the second row gives the results and the third and fourth rows show a detail with colors which enhance contrast.

Click to enlarge. Click to kill. Click to enlarge. Click to kill. Click to enlarge. Click to kill. Click to enlarge. Click to kill.
Click to enlarge. Click to kill. Click to enlarge. Click to kill. Click to enlarge. Click to kill. Click to enlarge. Click to kill.

Click to enlarge. Click to kill. Click to enlarge. Click to kill. Click to enlarge. Click to kill. Click to enlarge. Click to kill.
Click to enlarge. Click to kill. Click to enlarge. Click to kill. Click to enlarge. Click to kill. Click to enlarge. Click to kill.
Gaussian (sigma=20)Uniform (+/-20)Salt and pepper (3%)Periodic (jpg)

Execution time on a AMD 1800+ for the 384x288 image: 0.04 seconds.

First remark: the filter gives excellent results on the "salt and pepper" noise. However, other results are poor. The periodic noise is still present.

Second remark: this filter keeps contours. But is has a defect. It rounds corners (or any angle if less than 180 degrees), as shown on a detail below on the white labels.


Previous  Next 

visiteurs
Generated with webSitePP.py tool
Last updated on October 20, 2004