Skip to content

Frost filter

Fact Value
Also called Frost speckle filter
Status Implemented and tested
Family Adaptive and statistical filters
Engine Browser
Type Nonlinear, statistical, adaptive exponential kernel
Output Image
Operator shown as estimator (exact)
Support radius floor(size / 2)
Code web/src/core/filters/adaptive/speckle.ts, frostFilter
Operator code web/src/core/filters/adaptive/speckle.ts, frostFilter
Channels RGB, Brightness only

Overview

The Frost filter is a weighted mean whose weights fall exponentially with the distance from the center. How fast they fall depends on the local variation. In flat areas the weights are nearly equal, and the filter averages the whole window. Near edges they fall fast, and the pixel stays close to itself.

Three panels: disks with gray speckle, the Frost result with damping 1, smooth with soft edges, and with damping 5, sharper with more speckle left. Three panels: disks with gray speckle, the Frost result with damping 1, smooth with soft edges, and with damping 5, sharper with more speckle left.
A small damping smooths strongly. A larger damping keeps more of the edges and the speckle.

How it works

  1. Find the coefficient of variation C_I of the window.
  2. Weight each window pixel by exp(-K C_I^2 d), where d is its distance from the center.
  3. Write the weighted mean.

Mathematical foundation

\[ \hat{R} = \frac{\sum_{q \in W} e^{-K C_I^2 d_q}\, I_q}{\sum_{q \in W} e^{-K C_I^2 d_q}} \]

The formula shows the default parameter values.

where

  • \(d_q\): The distance of pixel q from the center
  • \(C_I\): The coefficient of variation of the window
  • \(K\): The damping

d_q is the distance of window pixel q from the center, and C_I the coefficient of variation of the window. In flat areas C_I is small, the weights are nearly equal, and the output is close to the window mean. Near edges C_I is large, the weights fall off fast, and the output stays close to the pixel. This is the exponential weighting of Frost and others, with the damping K, as it is usually implemented.

Frost and others derived the filter from a model of radar images in which the scene reflectivity is correlated with an exponential falloff. The decay rate of the weights grows with C_I squared, the local variation. This is the form most programs implement, with the damping K. With K = 0 every weight is 1 and the filter is the box mean.

Kernel or operator

There is no fixed kernel. The Inspector shows the weight formula with the current damping. The worked example below lists the weights for one window.

Algorithm

  1. Pad the image with the border mode.
  2. Compute C_I of each window with running sums.
  3. Weight each window pixel by exp(-K C_I^2 d).
  4. Write the weighted mean.

Parameters

Parameter Default Values Meaning
Window size size 7 3 to 15, odd px Width and height of the window for the local statistics.
Damping K damping 1 0 to 10 K, how fast the weights fall with distance for a given local variation.
Border mode border Reflect 101 (default) Reflect 101 (default), Reflect, Replicate, Constant (zero), Wrap How pixels outside the image are filled when the window reaches past the edge.
Channels channelScope RGB RGB, Brightness only Which part of the color image the filter changes.

Implementation

frostFilter in web/src/core/filters/adaptive/speckle.ts computes C_I with running sums, then weights each window from gatherPlane by the precomputed distances. The filter runs in the browser engine, in Web Workers, through the shared filter framework in web/src/core/filters/run.ts. It handles the border mode, the channel scope, alpha and the rounding to 8 bits. Each strip of the image gets a halo as wide as the support radius, so strips give exactly the pixels of a whole-image run.

Worked example

\[ W = \begin{bmatrix} 96 & 121 & 104 & 88 & 112 \\ 108 & 93 & 131 & 99 & 101 \\ 85 & 117 & 150 & 106 & 94 \\ 110 & 102 & 90 & 124 & 97 \\ 99 & 114 & 105 & 92 & 118 \end{bmatrix} \]

C_I = 0.1377, so with K = 1 the weights are exp(-0.01895 d):

Distance d 0 1 1.414 2 2.828
Weight 1 0.98122 0.97355 0.96280 0.94780

The local variation is small, so the weights barely fall, and the output is close to the window mean: 106.322. In a window with a strong edge, C_I would be several times larger and the weights would fall much faster.

Complexity

  • Time: \(O(N\,k^2)\)
  • Memory: \(O(N)\)

N is the number of pixels per channel and k the window width.

Artifacts and limitations

Limitations

  • The damping must be tuned to the image.
  • Slower than the Lee filter for large windows.

Artifacts

  • Some speckle left along edges.

Tests

No common library has this filter, so the reference applies the same formulas to NumPy windows of an input whose values are all above 0. Before it is used, the script checks that K = 0 gives scipy.ndimage.uniform_filter. The test covers two window and damping settings for all five border modes.

References

  • Frost, V. S., Stiles, J. A., Shanmugan, K. S. and Holtzman, J. C. A model for radar images and its application to adaptive digital filtering of multiplicative noise. IEEE Transactions on Pattern Analysis and Machine Intelligence PAMI-4(2), 157 to 166, 1982. DOI 10.1109/TPAMI.1982.4767223.
  • Lopes, A., Touzi, R. and Nezry, E. Adaptive speckle filters and scene heterogeneity. IEEE Transactions on Geoscience and Remote Sensing 28(6), 992 to 1000, 1990. DOI 10.1109/36.62623.