Skip to content

SUSAN noise filter

Fact Value
Also called SUSAN smoothing, SUSAN structure-preserving noise reduction
Status Implemented and tested
Family Nonlinear spatial filters
Engine Science engine
Type Nonlinear, spatial, brightness-weighted averaging
Output Image
Operator shown as algorithm (exact)
Support radius ceil(2 * sigma)
Code engine/src/pixelnexus_engine/filters/edge_preserving.py, susan_smoothing
Operator code engine/src/pixelnexus_engine/filters/edge_preserving.py, susan_smoothing_representation
Channels RGB, Brightness only, Color only

Overview

The SUSAN noise filter averages each pixel with neighbors of similar brightness, after Smith and Brady. The weights fall with distance and with the brightness difference. The pixel itself is left out, so a single noisy pixel cannot keep its own value. Where no neighbor is similar at all, the pixel takes the median of its 8 neighbors. The filter runs in the PixelNexus engine, with our own code.

Four panels. A noisy bright disk and gray square on a dark ground. With a threshold of 20, the noise is a little softer. With a threshold of 40, the areas are much smoother and the edges stay sharp. With a threshold of 10, the result looks almost like the input. Four panels. A noisy bright disk and gray square on a dark ground. With a threshold of 20, the noise is a little softer. With a threshold of 40, the areas are much smoother and the edges stay sharp. With a threshold of 10, the result looks almost like the input.
A disk and a square with noise of sigma 20. Then the SUSAN noise filter with a brightness threshold of 20, 40 and 10.

How it works

  1. For each pixel, weigh every neighbor in the window by distance and by brightness difference.
  2. Leave out the pixel itself.
  3. Replace the pixel with the weighted mean.
  4. Where every weight is 0, use the median of the 8 neighbors.

Mathematical foundation

\[ J(x) = \frac{\sum_{d \ne 0} I(x + d) \, e^{-\frac{\lvert d \rvert^2}{2\sigma^2} - \frac{(I(x + d) - I(x))^2}{t^2}}}{\sum_{d \ne 0} e^{-\frac{\lvert d \rvert^2}{2\sigma^2} - \frac{(I(x + d) - I(x))^2}{t^2}}} \]

The formula shows the default parameter values.

where

  • \(J(x)\): The result at pixel x
  • \(I\): The image channel
  • \(d\): The offset of a neighbor
  • \(\sigma\): The spatial sigma
  • \(t\): The brightness threshold

Each neighbor x + d gets a weight that falls with its distance, by a Gaussian of sigma. It also falls with the brightness difference from the center, by a Gaussian of the threshold t. So the neighbors that count are those on the same side of an edge, the univalue segment of Smith and Brady. The sums leave out d = 0, the center itself. So a single noisy pixel is replaced by its similar neighbors, or, when none is similar enough that a weight remains, by the median of its 8 neighbors.

The weight is the product of two Gaussians, one in space and one in brightness. It is close to a bilateral filter, with two differences. The center pixel is left out, which removes single noisy pixels. And when no neighbor is similar enough that a weight remains, the median of the 8 neighbors takes over. Smith and Brady called the set of similar neighbors the univalue segment assimilating nucleus, the USAN.

Kernel or operator

There is no fixed kernel. The Inspector asks the engine for the stages with the current settings.

Parameters

Parameter Default Values Meaning
Brightness threshold threshold 20 1 to 100 levels The brightness threshold t. Neighbors that differ by much more than t barely count. It should be above the noise and below the contrast of the edges to keep. 20 is our choice.
Spatial sigma sigma 2 0.5 to 5 px The sigma of the spatial Gaussian. The window reaches ceil(2 sigma) pixels in each direction, our choice. 2 is our choice.
Channels channelScope RGB RGB, Brightness only, Color only Which part of the color image the filter changes.

Implementation

susan_smoothing in engine/src/pixelnexus_engine/filters/edge_preserving.py is our own code, following the rule of Smith and Brady. The window reaches ceil(2 sigma) pixels in each direction, and the plane is padded by repeating its edge pixels. Both are our choices. In floating point, a weight is only exactly 0 when the brightness difference is more than about 27 times the threshold, so the median fallback is rare.

Worked example

Threshold t Sigma PSNR (dB)
10 1 23.54
10 2 23.28
20 1 25.63
20 2 25.49
40 1 30.00
40 2 30.41

The image of the figure, with the other defaults. The PSNR compares the result with the image before the noise. The noisy input scores 22.22 dB.

The threshold has to sit above the noise. At 10, half the noise sigma, little changes. At 40, twice the noise sigma, the PSNR rises by 8 dB and the edges, of 110 to 140 levels, still hold. The spatial sigma matters little here.

Complexity

  • Time: \(O(N R^2)\)
  • Memory: \(O(N)\)

N is the number of pixels and R the window radius.

Artifacts and limitations

Limitations

  • Noise much stronger than the threshold stays.
  • The threshold must fit both the noise and the edges, which is hard in images with mixed contrast.

Artifacts

  • Flat, cartoon-like areas at high thresholds.

Tests

The result must match a direct loop over the window to 1e-12. A single bright pixel must take the value of its neighbors, and a pixel with no similar neighbor must take their median. The representation must have its three stages.

References

  • Smith, S. M., and Brady, J. M. SUSAN, a new approach to low level image processing. International Journal of Computer Vision 23(1), 45 to 78, 1997. DOI 10.1023/A:1007963824710.