Laplacian filter

This tool can be used to perform a Laplacian filter on a raster image. A Laplacian filter can be used to emphasize the edges in an image. As such, this filter type is commonly used in edge-detection applications. The algorithm operates by convolving a kernel of weights with each grid cell and its neighbours in an image. Four 3x3 sized filters and one 5x5 filter are available for selection. The weights of the kernels are as follows:

3x3 (1)

0 -1 0
-1 4 -1
0 -1 0

3x3 (2)

0 -1 0
-1 5 -1
0 -1 0

3x3 (3)

-1 -1 -1
-1 8 -1
-1 -1 -1

3x3 (4)

1 -2 1
-2 4 -2
1 -2 1

5x5 (1)

0 0 -1 0 0
0 -1 -2 -1 0
-1 -2 17 -2 -1
0 -1 -2 -1 0
0 0 -1 0 0

5x5 (2)

0 0 -1 0 0
0 -1 -2 -1 0
-1 -2 16 -2 -1
0 -1 -2 -1 0
0 0 -1 0 0

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"
direction = "3 x 3 (1)"
args = [inputFile, outputFile, direction]
pluginHost.runPlugin("FilterLaplacian", 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 direction = "5 x 5 (1)"
String[] args = [inputFile, outputFile, direction]
pluginHost.runPlugin("FilterLaplacian", args, false)

Credits: