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

The user must specify the `variant`, including '3x3(1)', '3x3(2)', '3x3(3)', '3x3(4)', '5x5(1)', and '5x5(2)'. The user may also optionally clip the output image distribution tails by a specified amount (e.g. 1%).

## See Also

prewitt_filter, sobel_filter

## Function Signature

`def laplacian_filter(self, raster: Raster, variant: str = "3x3(1)", clip_amount: float = 0.0) -> Raster: ...`

## Project Links

WbW Homepage User Manual Support WbW