Salt and Pepper Filter

As the name of this filter is self explanatory, this is used to remove the noise that is of the form of salt i.e. very little (dot....etc.). The algorithms used in this is as follows:
Suppose you want to calculate the pixel value of some particular pixel, then take a 3x3 window about that pixel.

P(4)    P(3)    P(2)
P(5)    P(0)    P(1)
P(6)    P(7)    P(8)

Then for the pixel P(0) we calculate B(P) as follows,
B(P) = P(1) + P(3) + P(5) + P(7)
and suppose the corresponding pixel in the new image is P1 then we will assign the pixel value to this depending upon the value of B(P).
if   B(P)  < 1   B(P1)  = WHITE
else if B(P) > 1 B(P1)  = BLACK
else  B(P1)  = B(P)

Now in the new image all the noise will be removed.
 
 

[Back]
[Main Page] [ Course page ] [ Course Projects]
[Amit] [Kamat]