Median Filter in Image Processing

The median filter in image processing is normally used to reduce noise in an image, somewhat like the mean filter. However, it often does a better job than the mean filter of preserving useful detail in the image.

What is Median Filter ? Definition


Median Filter is a simple and powerful non-linear filter.

  • It is used for reducing the amount of intensity variation between one pixel and the other pixel.
  • In this filter, we replaces pixel value with the median value .
  • The median is calculated by first sorting all the pixel values into ascending order and then replace the pixel being calculated with the middle pixel value
  • Salt and pepper noise.

Mean filtering is a simple, intuitive and easy to implement method of smoothing images, i.e. reducing the amount of intensity variation between one pixel and the next. It is often used to reduce noise in images.

How to work the Median Filter


The median filter considers each pixel in the image in turn and looks at its nearby neighbors to decide whether or not it is representative of its surroundings.

Instead of simply replacing the pixel value with the mean of neighboring pixel values, it replaces it with the median of those values.

The median is calculated by first sorting all the pixel values from the surrounding neighborhood into numerical order and then replacing the pixel being considered with the middle pixel value. (If the neighborhood under consideration contains an even number of pixels, the average of the two middle pixel values is used.)

Example 1: 3×3 Median Filter

2D Median filtering example using a 3 x 3 sampling window:

Keeping border values unchanged

Median Filter in Image Processing

Extending border values outside with values at boundary

Median Filter in Image Processing

Extending border values outside with 0s

Median Filter in Image Processing

Example 2: 3×3 Median Filter

Median Filter in Image Processing

then,

Median Filter in Image Processing

Be the first to comment

Leave a Reply

Your email address will not be published.


*