Add speckle noise¶
| Fact | Value |
|---|---|
| Also called | Multiplicative noise |
| Status | Implemented and tested |
| Family | Utilities |
| Engine | Browser |
| Type | Nonlinear, statistical, multiplicative random noise |
| Output | Image |
| Operator shown as | random-process (exact) |
| Support radius | 0 |
| Code | web/src/core/filters/utility/noise.ts, speckleNoiseFilter |
| Operator code | web/src/core/math/random.ts, positionNormal |
| Channels | RGB |
Overview¶
Add speckle noise multiplies every pixel by a random factor around 1. Bright pixels change by more levels than dark ones, and black stays black. This is the noise model of the Lee, Kuan, Frost, Gamma-MAP and SRAD filters, so you can test them on a known noise level.
How it works¶
- Draw a standard normal number for each pixel and channel, from the seed and the position.
- Multiply the value by 1 plus sigma times that number.
- Clip the result to 0 to 255.
Mathematical foundation¶
The formula shows the default parameter values.
where
- \(n\): A standard normal random number
- \(\sigma\): The standard deviation of the factor
Each value is multiplied by a random factor with mean 1 and standard deviation sigma. This is the "speckle" mode of skimage.util.random_noise, written with a standard deviation instead of a variance. Black stays black, and the noise grows with the brightness. The normal numbers come from the same position-based generator as Add Gaussian noise.
The factor has mean 1 and standard deviation sigma, so the noisy value has the clean value as its mean and sigma times the clean value as its standard deviation. Its coefficient of variation is sigma everywhere, so sigma is the C_u that the speckle filters need. This is the speckle mode of skimage.util.random_noise, which takes the variance instead of sigma.
Kernel or operator¶
There is no kernel. The Inspector describes the random process with the current sigma.
Algorithm¶
- For each pixel and channel, make a standard normal number from the seed, the position and the channel.
- Multiply the value by 1 plus sigma times that number.
- Clip to 0 to 255 and round. Keep alpha unchanged.
Parameters¶
| Parameter | Default | Values | Meaning |
|---|---|---|---|
Sigma sigma |
0.2 | 0 to 1 | The standard deviation of the random factor. It is the coefficient of variation C_u of the noise. |
Monochrome monochrome |
off | On or off | Use the same random factor for red, green and blue. |
Seed seed |
1 | 0 to 999999 | The starting number of the random generator. |
Implementation¶
speckleNoiseFilter in web/src/core/filters/utility/noise.ts uses the position-based normal numbers of Add Gaussian noise. They depend only on the seed, the position and the channel. So a strip gives the same noise as the whole image.
Worked example¶
| Value | Noise sigma in levels | With n = 1.5 |
|---|---|---|
| 50 | 10 | 65 |
| 100 | 20 | 130 |
| 200 | 40 | 260 |
With sigma = 0.2, the noise standard deviation is 0.2 times the value. A normal number n = 1.5 raises 50 by 15 but 200 by 60. Black, 0, stays black.
Complexity¶
- Time: \(O(N)\)
- Memory: \(O(N)\)
N is the number of pixels.
Artifacts and limitations¶
Limitations
- Real speckle in radar images follows a gamma or exponential distribution, not a normal one.
- Clipping at 255 changes the distribution in bright areas.
Artifacts
- Strong colored grain in bright areas, unless Monochrome is on.
Tests¶
A test adds speckle with sigma 0.1 to a flat gray image of value 128. It checks that the mean stays 128 and the standard deviation is 12.8, within rounding.
References¶
- scikit-image documentation, skimage.util.random_noise, mode speckle. https://scikit-image.org/docs/stable/api/skimage.util.html#skimage.util.random_noise
- Gonzalez, R. C. and Woods, R. E. Digital Image Processing, 4th edition. Pearson, 2018. Chapter 5.