This tool can be used to perform a ** difference-of-Gaussians filter** on a raster image.
Difference-of-Gaussians is a feature (edge) enhancement filter that involves the subtraction of one smoothed
version of an image from another less smoothed version of the image. The smoothed images are obtained by
convolving the original image with Gaussian filters with kernel weights
determined by two different Gaussian distributions (i.e. different standard deviations). Smoothing an image
using a Gaussian kernel suppresses only high-frequency spatial information. Subtracting one image from the
other preserves spatial information that lies between the range of frequencies that are preserved in the
two smoothed images. Thus, the difference-of-Gaussians is a band-pass filter (i.e. a filter that only passes
frequencies within a certain range).

The algorithm operates by differencing the results of convolving two kernels of weights with each grid cell and its neighbours in an image. The weights of the convolution kernels are determined by the 2-dimensional Gaussian (i.e. normal) curve, which gives stronger weighting to cells nearer the kernel centre. The size of the two convolution kernels are determined by setting the two standard deviation parameters; the larger the standard deviation the larger the resulting filter kernel. The second standard deviation should be a larger value than the first. Both standard deviations can range from 0.5-20.

The difference-of-Gaussians filter can be used to emphasize edges present in an image. Other edge sharpening filters also operate by enhancing high-frequency detail, but because random noise also has a high spatial frequency, many of these sharpening filters tend to enhance noise, which can be an undesirable artifact. The difference-of-Gaussians filter can remove high-frequency noise while emphasizing edges. This filter can, however, reduce overall image contrast.

The user may optionally choose to reflecting the data along image edges. ** NoData** values in
the input image are similarly valued in the output. The output raster is of the

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

```
wd = pluginHost.getWorkingDirectory()
```

inputFile = wd + "input.dep"

outputFile = wd + "output.dep"

standardDev1 = "2.0"

standardDev2 = "4.0"

reflectEdges = "true"

args = [inputFile, outputFile, standardDev1, standardDev2, reflectEdges]

pluginHost.runPlugin("FilterDoG", 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 standardDev1 = "2.0"

def standardDev2 = "4.0"

def reflectEdges = "true"

String[] args = [inputFile, outputFile, standardDev1, standardDev2, reflectEdges]

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

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