May 9, 2023

What is a Convolution Filter in Global Mapper Pro?

Written by: Amanda Lind

 

Don’t be convoluted by the title; the new Convolution Filter tool in Global Mapper Pro v24.1 is straightforward. Earlier versions of Global Mapper had the ability to apply a filter to an existing layer from the Raster Options Display Tab under Resampling. This new tool in Global Mapper Pro lets users create new layers with the filters, and create custom filters. Found in the Analysis dropdown menu, the Apply Convolution Filter to Layer tool takes any single raster layer (image or terrain) and applies a filter that can be used to sharpen, blur, enhance, or help detect edges.

Why use filters? 

Filters accentuate parts of a raster, be it image or terrain. They resample the data in order to sharpen, blur, enhance, help detect edges, or improve image quality. For example, below is an NAIP image of a town near agricultural land in Nevada. By applying a Sharpening High Pass filter, we’re better able to see distinct features in the landscape. This particular filter sharpens the edges of features, such as the individual shrubs or the roads. These sharpened features are also more easily distinguished when using tools that identify individual features in a raster image. In this example image, the roads are more sharply defined, making it easier for the Vectorize Raster tool to extract them with clean edges. The Convolution Filter tool works by recalculating the value (in this case, the color) of each pixel based on its neighbors by using a kernel.

Swipe to see how applying the Sharpen (High Pass) filter to this image helps make features more easily distinguishable.

What is a kernel?

Kernels are described as a grid matrix, where the cell being calculated is located in the center. Convolution filters work by using a moving, overlapping, often weighted, kernel (3×3, 5×5, etc.), to recalculate a pixel’s value based on the pixels around it. A pattern of values and zeros add weight or ignore certain values in the kernel in order to emphasize patterns depending on what cells are weighted, and by how much.

-1

-2 -1

0

0

0

1 2

1

This is a 3×3 kernel. Again, each cell in the grid represents a pixel, where the pixel in the center is the one that is being recalculated. The numbers in the surrounding cells are how much weight is being applied to neighboring pixel’s values when calculating the new value of the center pixel. This specific kernel in the Convolution Filter tool is used to apply the Gradient North filter. Gradient filters are often used for edge detection based on the edge’s orientation. Here we can see that by weighting the values to the north and south of the pixel, and not to the east and west, the new pixel value will be resampled to accentuate edges that are encountered as you move from the north to the south of the image. In elevation, this translates to highlighting areas that have a northern aspect.

Swipe to see how the Gradient North filter resamples this elevation layer.

For comparison, below is the Gradient East kernel. Gradient kernels can be used to detect edges in 45 degree increments: North, South, East, and West, based on the pattern of weights of the kernel. 

1

0 -1

2

0

-2

1 0

-1

The Gradient East filter recalculates pixel values to accentuate edges that you encounter when moving from the east to the west side of the layer.

After
Middle
Before
Directional filters are a great way to visualize how kernels work. Slide to compare the original DEM against a North Gradient filter, and an East Gradient.

The Convolution Filter tool is also supported in Global Mapper’s native scripting language with the APPLY_CONVOLUTION command. Read more about that function in the Knowledge Base, and more about Global Mapper scripting in this blog

Try Global Mapper Pro with a free 14-day trial today! If you have any questions, please contact us!

Companies using Blue Marble’s geospatial technology