# How does salt and pepper noise occurs in an image

How does salt & pepper noise occur? And, what are some techniques to remove it?

• One possible cause would be high-amplitude intermittent electrical interference, affecting either the analogue or digitised signal. For example, arcing on electrical contacts. Commented Feb 18, 2016 at 12:22

Salt-and-pepper noise is a form of noise sometimes seen on images. It presents itself as sparsely occurring white and black pixels.

In another words ( in the sense of pixels), salt and pepper noise means that are high frequencies, so for salt noise the values of this noise type is high (255 ... 200), and for the pepper noise the values of this noise type is low (5 ... 0).

To salt noise there are good filters like harmonic mean filters to salt and pepper noise.

$$\hat{f}(x,y) = \frac{mn}{\sum_{(s,t) \in S_{xy}}\frac{1}{g(s,t)} }$$

There are the contra harmonic filter that depends of a $$Q$$ argument, e.g., for salt noise $$Q$$ should be negative and for pepper Q should be positive.

$$\hat{f}(x,y) = \frac{\sum_{(s,t) \in S_{xy}}g(s,t)^{Q+1}}{{\tiny\sum_{(s,t) \in S_{xy}}}g(s,t)^{Q} }$$

Another aproach is the order statistics filters, e.g., $$\operatorname{max}$$ filter are good for pepper noise, and $$\operatorname{min}$$ filter are good for salt noise.

$$\hat{f}(x,y) = \operatorname{max}_{(s,t)\in S_{xy}}{g(s,t)}$$ $$\hat{f}(x,y) = \operatorname{min}_{(s,t)\in S_{xy}}{g(s,t)}$$

And another one is alpha trimmed filter that also are a order statistics filter type.

$$\hat{f}(x,y) = \frac{1}{mn-d}\sum_{(s,t) \in S_{x,y}} g_r(s,t)$$

Beside this there are Adaptive Mean Filter.

• For completion sake, when both salt and pepper noise are present, median filter is good. Commented Feb 5, 2019 at 13:18

According to Wikipedia, salt-and-pepper noise is generated by errors during analog to digital conversion or data transfer. It can be corrected with median filtering.

• A good answer should do more than quote a couple of sentences from Wikipedia...
– MBaz
Commented Feb 17, 2016 at 17:30
• A good question should ask for more than a couple of sentences from Wikipedia... Commented Feb 17, 2016 at 18:57
• I agree; that's what the downvote button is for. Personally, I prefer to give links or pointers to the answer as a comment.
– MBaz
Commented Feb 17, 2016 at 23:59