Raster Neighborhood Functions | Using the RasterConvolver

Liz Sanderson
Liz Sanderson
  • Updated

FME Version

  • FME 2022.0

Introduction

The RasterConvolver is a transformer that applies a convolution filter to raster data. Convolution filters are applied using a kernel which is specified by a matrix of weights for the neighboring values. Filtering can be used to smooth, sharpen, and enhance edges and other raster image manipulation operations.
 

Step-by-step Instructions

In this scenario, you are interested in applying a convolution filter in order to sharpen a GeoTIFF image. For more information on Raster processing using the RasterConvolver, check out the Edge Detection with the RasterConvolver article or the Raster Slope Calculations as a RasterConvolver Example article.

Source
The source dataset is an orthophoto of the City of Vancouver contained within a GeoTIFF. 
input.png

1. Create a New Workspace
Open FME Workbench and create a blank workspace. 
NewWorkspace.png
 
2. Add a GeoTIFF Reader
Add a GeoTIFF reader to the canvas by clicking on the Reader button on the top menu bar or by going to Readers > Add Reader. In the Add Reader dialog, select GeoTIFF as the Format, then for Dataset, browse to the BCVANC15_O7.tif dataset, which is available for download from the Files section on this article. 
Reader.png
 
3. Add a RasterConvolver
Click on the GEOTIFF reader feature type to select it.  Then add a RasterConvolver transformer to the canvas by typing “RasterConvolver” to bring up the list of FME Transformers in the Quick Add Search. Select the RasterConvolver from the list of Transformers by double-clicking or by using the arrow keys and the Enter key to add it. 
QuickAdd.png
Connection.png
 
Double-click on the RasterConvolver to open the parameters. In the parameters, change the Convolution Filter to Sharpen 3. Expand the Advanced section and set the Preserve Band Interperpreation to Yes. 
 RasterConvolutor.png
 
Note: By default, the preserve band interpretation is set to No - leaving this as No would convert the Red, Green, and Blue bands of the GeoTIFF to Real64 (i.e. convert to a grayscale image).
 
4. Run Workspace
Connect an Inspector transformer to the Output port on the RasterConvolutor. 
 Workspace.png

Run the workspace by clicking on the Run button on the top toolbar, or by using Run > Run Workspace on the top menu bar. 
Run.png
 
After running the workspace, the output will be sharpened. Try picking another filter from the RasterConvolver’s predefined convolution filters or enter your own values by setting the Convolution Filter to User Defined and entering Kernel Weights.

ouput.png
 

Data Attribution

Data used in this tutorial originates from open data made available by the City of Vancouver, British Columbia. It contains information licensed under the Open Government License - Vancouver.

Was this article helpful?

Comments

0 comments

Please sign in to leave a comment.