Convolution function

The Convolution function performs filtering on the pixel values in an image, which can be used for sharpening an image, blurring an image, detecting edges within an image, or other kernel-based enhancements. Filters are used to improve the quality of the raster image by eliminating spurious data or enhancing features in the data. These convolution filters are applied on a moving, overlapping kernel (window or neighborhood), such as 3 by 3. Convolution filters work by calculating the pixel value based on the weighs of its neighbors.

Notes

There are a number of convolution filter types you can choose in this function. You can also specify a User Defined type and enter your own kernel values.

For optimal display results, you may want to apply a histogram stretch to adjust the image's contrast or brightness to help highlight features.

Parameters

ParameterDescription

Raster

The input raster layer.

Type

Select the type of filtering you want to perform. There are options for sharpening, blurring, and detecting edges, or you can define your own kernel-based filter

Kernel

This table shows how each pixel will be weighted in the filtering process. This table can be edited if you choose User Defined as the Type.

Learn more about how convolution works

In the following tables, each filter is applied to one of these two images:

Unfiltered grayscale image
Unfiltered grayscale image
Unfiltered color image
Unfiltered color image

Edge detection filters

Gradient types

Gradient filters can be used for edge detection in 45 degree increments.

TypeDescriptionExample

Gradient East

A 3 by 3 filter

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

Gradient East result

Gradient North

A 3 by 3 filter

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

Gradient North result

Gradient North-East

A 3 by 3 filter

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

Gradient North-East result

Gradient North-West

A 3 by 3 filter

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

Gradient North-West result

Gradient South

A 3 by 3 filter

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

Gradient South result

Gradient West

A 3 by 3 filter

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

Gradient West result

Laplacian types

Laplacian filters are often used for edge detection. They are often applied to an image that has first been smoothed to reduce its sensitivity to noise.

TypeDescriptionExample

Laplacian 3x3

A 3 by 3 filter

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

Laplacian 3x3 result

Laplacian 5x5

A 5 by 5 filter

 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

Laplacian 5x5 result

Line detection types

Line detection filters, like the gradient filters, can be used to perform edge detection.

You may get better results if you apply a smoothing algorithm before an edge detection algorithm.

TypeDescriptionExample

Line Detection Horizontal

A 3 by 3 filter

-1 -1 -1
 2  2  2 
-1 -1 -1

Horizontal line detection result

Line Detection Left Diagonal

A 3 by 3 filter

 2 -1 -1
-1  2 -1
-1 -1  2

Left diagonal line detection result

Line Detection Right Diagonal

A 3 by 3 filter

-1 -1  2 
-1  2 -1
 2 -1 -1

Right diagonal line detection result

Line Detection Vertical

A 3 by 3 filter

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

Vertical line detection result

Sobel types

The Sobel filter is used for edge detection.

TypeDescriptionExample

Sobel Horizontal

A 3 by 3 filter

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

Sobel horizontal result

Sobel Vertical

A 3 by 3 filter

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

Sobel vertical result

Sharpening and smoothing filters

Sharpening types

The Sharpening (high-pass) filter accentuates the comparative difference in the values with its neighbors. A high-pass filter calculates the focal sum statistic for each cell of the input using a weighted kernel neighborhood. It brings out the boundaries between features (for example, where a water body meets the forest), thus sharpening edges between objects. The high-pass filter is referred to as an edge enhancement filter. The high-pass filter kernel identifies which cells to use in the neighborhood and how much to weight them (multiply them by).

TypeDescriptionExample

Sharpen

A 3 by 3 filter

  0    -0.25    0
-0.25    2    -0.25
  0    -0.25    0

Sharpen result

Sharpen More

A 3 by 3 filter

-0.25 -0.25 -0.25 
-0.25  3    -0.25 
-0.25 -0.25 -0.25

Sharpen II result

Sharpening 3x3

A high-pass 3 by 3 filter

-1 -1 -1 
-1  9 -1 
-1 -1 -1

Sharpening 3x3 result

Sharpening 5x5

A high-pass 5 by 5 filter

-1 -3 -4 -3 -1 
-3  0  6  0 -3 
-4  6 21  6 -4 
-3  0  6  0 -3
-1 -3 -4 -3 -1

Sharpening 5x5 result

Smoothing types

Smoothing (low-pass) filters smooth the data by reducing local variation and removing noise. The low-pass filter calculates the average (mean) value for each neighborhood. The effect is that the high and low values within each neighborhood are averaged out, reducing the extreme values in the data.

TypeDescriptionExample

Smooth Arithmetic Mean

A 3 by 3 filter

0.111  0.111  0.111
0.111  0.111  0.111
0.111  0.111  0.111

Smooth Arithmetic Mean result

Smoothing 3x3

A low-pass 3 by 3 filter

1  2  1
2  4  2
1  2  1

Smoothing 3x3 result

Smoothing 5x5

A low-pass 5 by 5 filter

1  1  1  1  1 
1  4  4  4  1 
1  4 12  4  1 
1  4  4  4  1 
1  1  1  1  1

Smoothing 5x5 result

Other filters

Point spread type

The point spread function portrays the distribution of light from a point source through a lense. This will introduce a slight blurring effect.

TypeDescriptionExample

Point Spread

A 3 by 3 filter

-0.627  0.352 -0.627
 0.352  2.923  0.352
-0.627  0.352 -0.627

Point Spread result