To Astronomy Home Page
To Top Level Menu

The Median Filter

====================
The Median filter is a very useful tool. It eliminates isolated hot or cold spots that can arise from noise, cosmic ray hits, or dead pixels. It is somewhat slow because it does a lot of calculations.

The Median filter takes the nine values in a 3x3 box centered on each pixel and arranges the values in ascending order. It then takes the difference between the 8th highest value and the 2nd highest value which it compares to the difference between the center pixel value and the 5th highest value (the median). If the second difference is greater than the first difference, the center pixel value is replaced with the median value. JIMSAIP uses the absolute value of the differences so that cold pixels are replaced as well as hot ones.

Effect of Median Filter
Original Median Filtered
Original Image Median Filtered Image

Sometimes it is better to run the Median filter more than once to really clean up an image.