# Gaussian filter

This tool can be used to perform a *Gaussian filter* on a raster image. A *Gaussian filter* can be used to emphasize the longer-range variability in an image, effectively acting to smooth the image. This can be useful for reducing the noise in an image. The algorithm operates by convolving a kernel of weights with each grid cell and its neighbours in an image. The weights of the
convolution kernel are determined by the 2-dimensional Gaussian (i.e. normal) curve, which gives stronger weighting to cells nearer the kernel centre. It is this characteristic that makes the *Gaussian filter* an attractive alternative for image smoothing and noise reduction than the Mean filter. The size of the filter is determined by setting the standard deviation parameter; the larger the standard deviation the larger the resulting filter kernel. The standard deviation can be any number in the range 0.5-20.

*NoData* values in the input image are replaced with the average value of all valid cells within the kernel. This is also the procedure when the neighbourhood around a grid cell extends beyond the edge of the grid. 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"

stdDevDist = "0.75"

reflectEdges = "true"

args = [inputFile, outputFile, stdDevDist, reflectEdges]

pluginHost.runPlugin("FilterGaussian", 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 stdDevDist = "0.75"

def reflectEdges = "true"

String[] args = [inputFile, outputFile, stdDevDist, reflectEdges]

pluginHost.runPlugin("FilterGaussian", args, false)

## Credits:

- John Lindsay (2012) email: jlindsay@uoguelph.ca