Lee (Sigma) filter

The Lee filter (or sigma filter) is a convolution filter devised by Lee (1983) that is commonly used in image processing to remove speckle-type noise from images. Speckle, or white noise, is short-scale variation with low spatial autocorrelation. The Lee filter is therefore used to smooth images, but unlike other smoothing filters like the Mean filter, the Lee filter is better at preserving edge features in the original image.

The Lee filter smooths image noise by averaging only those neighbourhood pixels that have intensities within a fixed range of the centre pixel. This range is defined as the centre pixel intensity value plus and minus two-sigma values, where sigma is a user-specified parameter. Sigma should be related to the standarad deviation of the statistical distribution of image speckle noise, assuming a Gaussian form of the distribution.

The M-Threshold parameter is the minimum allowable number of pixels within the intensity range. Pixels with fewer neighbours within the intensity range than this threshold will have their neighbourhood average substituted for the sigma-restricted average in the output image.

NoData values in the input image are ignored during filtering. When the neighbourhood around a grid cell extends beyond the edge of the grid, NoData values are assigned to these sites. The output raster is of the float data type and continuous data scale.

See Also:

Scripting:

The following is an example of a Python script that uses this tool:

wd = pluginHost.getWorkingDirectory()
inputFile = wd + "input.dep"
outputFile = wd + "output.dep"
neighbourhoodSizeX = "5"
neighbourhoodSizeY = "5"
sigma = "2"
mThreshold = "10"
reflectEdges = "true"
args = [inputFile, outputFile, neighbourhoodSizeX, neighbourhoodSizeY, sigma, mThreshold, reflectEdges]
pluginHost.runPlugin("LeeSigmaFilter", args, False)

This is a Groovy script also using the tool:

def wd = pluginHost.getWorkingDirectory()
def inputFile = wd + "input.dep"
def outputFile = wd + "output.dep"
def neighbourhoodSizeX = "5"
def neighbourhoodSizeY = "5"
def sigma = "2"
def mThreshold = "10"
def reflectEdges = "true"
String[] args = [inputFile, outputFile, neighbourhoodSizeX, neighbourhoodSizeY, sigma, mThreshold, reflectEdges]
pluginHost.runPlugin("LeeSigmaFilter", args, false)

Credits:

References: