Kuan filter¶
| Fact | Value |
|---|---|
| Also called | Kuan speckle filter |
| Status | Implemented and tested |
| Family | Adaptive and statistical filters |
| Engine | Browser |
| Type | Nonlinear, statistical, local linear estimator for multiplicative noise |
| Output | Image |
| Operator shown as | estimator (exact) |
| Support radius | floor(size / 2) |
| Code | web/src/core/filters/adaptive/speckle.ts, kuanFilter |
| Operator code | web/src/core/filters/adaptive/speckle.ts, kuanWeight |
| Channels | RGB, Brightness only |
Overview¶
The Kuan filter reduces speckle with the same idea as the Lee filter: smooth where the window varies only by speckle, keep where it varies more. Kuan, Sawchuk, Strand and Chavel derived the weight without the approximation Lee made, by treating the speckle as a signal-dependent additive noise. The result is the Lee weight divided by 1 + C_u squared.
How it works¶
- Find the mean and the coefficient of variation C_I of the window.
- Compute the weight W = (1 - C_u^2 / C_I^2) / (1 + C_u^2), at least 0.
- Write the mean plus W times the difference between the pixel and the mean.
Mathematical foundation¶
The formula shows the default parameter values.
where
- \(m\): The window mean
- \(C_I\): The coefficient of variation of the window
- \(C_u\): The coefficient of variation of the speckle
- \(W\): The weight of the pixel
m is the window mean and C_I its coefficient of variation. Kuan, Sawchuk, Strand and Chavel turn the multiplicative noise into a signal-dependent additive noise and derive the linear minimum mean-square error weight without the linear approximation of Lee. The result is the Lee weight divided by 1 + C_u squared, as Lopes, Touzi and Nezry write it.
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. The Kuan weight is the exact linear minimum mean-square error weight for this model. Because of the factor 1 / (1 + C_u^2), it never reaches 1, so even strong edges are smoothed a little. For weak speckle, C_u is small and the Kuan and Lee filters almost agree.
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¶
- Pad the image with the border mode.
- Compute the mean and variance of each window with running sums.
- Compute C_I and the Kuan weight W.
- Write the mean plus W times the difference between the pixel and the 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. |
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. |
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¶
kuanFilter in web/src/core/filters/adaptive/speckle.ts shares the local statistics with the Lee filter and applies kuanWeight. 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¶
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, the Lee weight is 0.4724, and the Kuan weight is that divided by 1 + 0.1^2, 0.4678. The output for the center 150 is 126.709, a little closer to the mean than the Lee filter gives.
Complexity¶
- Time: \(O(N)\)
- Memory: \(O(N)\)
N is the number of pixels per channel. Running sums make the cost independent of the window size.
Artifacts and limitations¶
Limitations
- The weight never reaches 1, so even strong edges are smoothed a little.
- Leaves speckle next to edges.
Artifacts
- Noisy halos along edges, as with the Lee filter.
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 its weights are the Lee weights divided by 1 + C_u^2. The test covers two window and C_u settings for all five border modes.
References¶
- Kuan, D. T., Sawchuk, A. A., Strand, T. C. and Chavel, P. Adaptive noise smoothing filter for images with signal-dependent noise. IEEE Transactions on Pattern Analysis and Machine Intelligence PAMI-7(2), 165 to 177, 1985. DOI 10.1109/TPAMI.1985.4767641.
- 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.