Edd's Knowledge Base

Image noise is random variation in pixel values that does not come from the scene. Different noise processes call for different filters, so recognising the type is the first step in removing it.

Common Noise Models

TypeModelTypical causeLooks likeGood filter
Gaussian (additive)Sensor and electronics noiseFine grain over every pixelGaussian blur, averaging
Salt-and-pepper (impulse)Each pixel set to 0 or 255 with some probability, others untouchedDead or stuck pixels, transmission errorsIsolated black and white dotsMedian filter
Poisson (shot)Variance grows with the signalPhoton counting in low lightGrainier in dark regionsVariance-stabilizing transforms, then Gaussian-style denoising
Speckle (multiplicative)Ultrasound, radarGranular texture scaled by intensitySpecialised speckle filters

Gaussian noise corrupts every pixel by a small amount, so averaging cancels it. Salt-and-pepper corrupts a fraction of pixels by a huge amount, so averaging smears the outliers and the median ignores them (Median Filter).

Simulating Salt-and-Pepper Noise

A common recipe corrupts an image with two independent masks, each at rate (for example for noise level ):

img[np.random.random(img.shape) < p] = 0          # pepper: black pixels
img[np.random.random(img.shape) > 1 - p] = 255    # salt: white pixels

A full generation loop is in Template Matching Snippets. Because the masks are independent, the fraction of corrupted pixels is about , so the “40%” label is about 64% corrupted. See Median Filter for the full conversion table and Template Matching for how SAD and NCC cope.

Noise Is Not a Brightness or Contrast Change

An affine intensity change is a global, deterministic transformation. Noise is random and local. That is why NCC’s invariance to and does not explain why it tolerates salt-and-pepper noise better than SAD; its advantage there is that it compares the pattern across the window.

Source: Image noise (Wikipedia).


Related: Computer Vision MOC, Median Filter, Gaussian Filtering and Convolution, Template Matching