Applying noise using noise models to images
In digital image processing, degradation is typically modeled as an additive process:
Where
Let's look at a simple
Here is how two different noise models would numerically attack this matrix:
Example 1: Adding Impulse (Salt-and-Pepper) Noise
Salt-and-Pepper noise doesn't add a continuous value; it acts as a probability-based replacement.
1. Define the PDF Rules:
-
Probability of Salt (
): 10% (0.1). The pixel becomes 255 (pure white). -
Probability of Pepper (
): 20% (0.2). The pixel becomes 0 (pure black). -
Probability of remaining unchanged: 70% (0.7). The pixel stays 100.
2. The Random Process:
The computer evaluates every single pixel and generates a random probability number between 0.00 and 1.00 for each one. Let's assume the computer rolls the following random numbers for our 9 pixels:
3. Applying the Thresholds:
-
If roll < 0.10
Pixel becomes 255 (Salt). -
If 0.10
roll < 0.30 Pixel becomes 0 (Pepper). -
If roll
0.30 Pixel stays 100.
4. The Final Corrupted Matrix,
Notice how the noise completely obliterated the original data in the affected pixels, creating extreme black and white spikes.
Example 2: Adding Gaussian Noise
Gaussian noise is strictly additive. It generates random numerical offsets based on a bell curve. Most offsets will be small (near the mean), but a few will be large.
1. Define the PDF Rules:
-
Mean (
): 0. (The noise is centered around zero, meaning it will brighten and darken pixels equally). -
Standard Deviation (
): 15. (Controls how wide the bell curve is. A higher means more severe noise).
2. The Random Process:
The computer samples 9 values from a Gaussian distribution with
3. The Additive Math (
We simply add the noise matrix to the original image matrix. (Note: If a value drops below 0 or exceeds 255, we clip it).
4. The Final Corrupted Matrix,
Notice how unlike Salt-and-Pepper, Gaussian noise affects absolutely every pixel, but the original 100 intensity is still "hidden" within the noisy values.