Why median filter is considered as good for removal of salt and pepper noise? What are the other filters used for the same?

  • 1
    $\begingroup$ Related: dsp.stackexchange.com/questions/15203/… and dsp.stackexchange.com/questions/7819/… $\endgroup$
    – A_A
    Commented Nov 18, 2015 at 9:25
  • $\begingroup$ Salt and Pepper noise is often modeled as a multiplicative noise process - the power of the noise is proportional to the power of the signal of interest. Therefore traditional low-pass or other frequency domain approaches aren't very effective. A median filter is a non-linear filter and is more effective against this type of noise. Wouldn't go so far as to say it's the best - it depends how you define best. $\endgroup$
    – David
    Commented Nov 18, 2015 at 13:55
  • $\begingroup$ "The best" is a bit all-encompassing. The best out of what, and based on what criteria? $\endgroup$
    – Simon B
    Commented Nov 18, 2015 at 13:56

2 Answers 2


Median filter is considered good because unlike averaging filter which ruins the edges of an image by blurring it to remove the noise, median filter removes only the noise without disturbing the edges.

Well, median filter is the best and only filter to remove salt and pepper noise.

Hope this helps:)

Thank you!!!


Let us look at a $3\times 3$ patch of pixels:


And assume that you have for instance $2$ salt and $3$ pepper pixels, which is pretty harsh. Then you have four valid pixels, let us call them, in magnitude order $p_a$, $p_b$, $p_c$, $p_d$. Then ordering all the values, you get:

$$p \le p \le p_a \le p_b \le p_c \le p_d \le s \le s \le s$$

The median will thus be $p_c$, one of the valid pixel values. As you see, the output is not dependent on the $b=$ or $w=255$ values. Since it is based on ordering, it may tolerate up to $4$ black or white, still outputing one of the valid pixel value. Whether that value is a meaningful candidate for the patch is another story. A complete two-pass scheme is detailed in Salt-and-Pepper Noise Removal by Median-Type Noise Detectors and detail-Preserving Regularization, 2005

This paper proposes a two-phase scheme for removing salt-and-pepper impulse noise. In the first phase, an adaptive median filter is used to identify pixels which are likely to be contaminated by noise (noise candidates). In the second phase, the image is restored using a specialized regularization method that applies only to those selected noise candidates. In terms of edge preservation and noise suppression, our restored images show a significant improvement compared to those restored by using just nonlinear filters or regularization methods only. Our scheme can remove salt-and-pepper-noise with a noise level as high as 90%.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.