Median Filter: Median filter, as the name implies, replaces the center value of a mask with the median of all the values of the mask. Simply taking some grey-scale values of an image and taking a 3×3 mask. Now we have 9 values and the 5th value is the median. Thus, the center value of the mask will be replaced by the median. So, the implementation of this filter is as follows,
- First of all, a mask has to be taken of odd number such as 3×3, 5×5 etc. Here taking 3×3.
- Now we will arrange the values of the mask in ascending or descending order to find the median.
- Then the median will be used to replace the center value of the mask.
Places to use this filter:
- This filter provides excellent noise reduction with considerably less blurring effect than low pass filter.
- Median filters are particularly effective in the presence of impulse noise, also called salt-and-peeper noise.
Disadvantages :
- Less but it also causes blur effect.
- Loss of sharpness.
- It also tends to turn an image to an image consisting almost similar grey-scale levels everywhere.