Skip to content

Enhanced Lee filter

Fact Value
Also called Enhanced Lee speckle filter
Status Implemented and tested
Family Adaptive and statistical filters
Engine Browser
Type Nonlinear, statistical, classified local estimator for multiplicative noise
Output Image
Operator shown as estimator (exact)
Support radius floor(size / 2)
Code web/src/core/filters/adaptive/speckle.ts, enhancedLeeFilter
Operator code web/src/core/filters/adaptive/speckle.ts, enhancedLeeValue
Channels RGB, Brightness only

Overview

The enhanced Lee filter sorts each window into one of three classes by its coefficient of variation. Pure speckle gets the window mean, so flat areas are fully smoothed. Strong targets and edges, with a variation above C_max, are kept unchanged. Windows between get a smooth blend of the mean and the pixel.

Three panels: disks with gray speckle, the Lee result, and the enhanced Lee result with smoother flat areas and the small bright dots kept. Three panels: disks with gray speckle, the Lee result, and the enhanced Lee result with smoother flat areas and the small bright dots kept.
The enhanced Lee filter smooths flat areas fully and keeps the small bright dots.

How it works

  1. Find the mean and the coefficient of variation C_I of the window.
  2. If C_I is at most C_u, write the mean. If it is at least C_max, keep the pixel.
  3. Otherwise blend the mean and the pixel with the weight W = exp(-K (C_I - C_u) / (C_max - C_I)).

Mathematical foundation

\[ \hat{R} = \begin{cases} m & C_I \le C_u \\ m\,W + z\,(1 - W),\quad W = e^{-K \frac{C_I - C_u}{C_{\max} - C_I}} & C_u < C_I < C_{\max} \\ z & C_I \ge C_{\max} \end{cases}, \qquad C_{\max} = \sqrt{1 + 2 C_u^2} \]

The formula shows the default parameter values.

where

  • \(C_I\): The coefficient of variation of the window
  • \(C_u\): The coefficient of variation of the speckle
  • \(C_{\max}\): The upper class limit
  • \(K\): The damping

Lopes, Touzi and Nezry split the image into three classes by the local coefficient of variation C_I. Below C_u the window is pure speckle, so the output is the mean m. Above C_max it holds a strong target or edge, so the pixel z is kept. Between, the weight W blends the two, with the damping K. C_max = sqrt(1 + 2 C_u^2) is the largest variation pure speckle is expected to reach.

Speckle multiplies the clean value by a random factor with mean 1. Its coefficient of variation C_u, the standard deviation of the factor, is the same everywhere. So in a flat area the local coefficient of variation C_I, the window standard deviation over the window mean, is close to C_u. A window with an edge or a target varies more, and C_I is larger. Lopes, Touzi and Nezry add the upper limit C_max = sqrt(1 + 2 C_u^2), the largest variation that speckle alone is expected to reach. Above it, the window holds a real target, so nothing is changed. The weight W falls from 1 at C_u to 0 at C_max, and the damping K sets how fast.

Kernel or operator

There is no kernel. The Inspector shows the formula with the current C_u. The Rank stepper in the Learn panel shows the window at any pixel next to the value the filter gives there.

Algorithm

  1. Pad the image with the border mode.
  2. Compute the mean and variance of each window with running sums.
  3. Compute C_I and find its class.
  4. Write the mean, the pixel, or the blend with weight W.

Parameters

Parameter Default Values Meaning
Window size size 7 3 to 15, odd px Width and height of the window for the local statistics.
Speckle variation C_u cu 0.25 0.01 to 1 The coefficient of variation of the speckle, its standard deviation over its mean. For an L-look intensity image it is 1 over the square root of L.
Damping K damping 1 0 to 10 How fast the blend moves from the mean to the pixel as the variation grows.
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

enhancedLeeValue in web/src/core/filters/adaptive/speckle.ts applies the three classes to each pixel, with the local statistics shared by all speckle filters. 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} \]

The window mean is m = 106.24 and its standard deviation 14.627, so C_I = 14.627 / 106.24 = 0.1377. With C_u = 0.1, C_max = sqrt(1 + 2 x 0.1^2) = 1.0100. C_I lies between C_u and C_max, so the pixel is in the middle class. With K = 1, W = exp(-(0.1377 - 0.1) / (1.0100 - 0.1377)) = 0.9577. The output is m W + z (1 - W) = 108.090.

Complexity

  • Time: \(O(N)\)
  • Memory: \(O(N)\)

N is the number of pixels per channel.

Artifacts and limitations

Limitations

  • Needs C_u and the damping.
  • Class borders can show as a change in texture.

Artifacts

  • Small patches where neighboring pixels fall into different classes.

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. It follows the three classes of Lopes, Touzi and Nezry. The test covers two window and C_u settings with damping 1 for all five border modes.

References

  • 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.