DescriptionThe RasterExpressionEvaluator is a transformer that evaluates expressions on each cell in a raster, such as algebraic operations or conditional statements.
Simple Calculation Examples
Inverting ColorsThis example demonstrates how to invert images with the following band interpretation list and expression:
The images show Heritage Mountain Elementary School and the surrounding area in Google Earth
- See RGBColorInverter.fmwt in the attached zip file
Brightness CorrectionIf an image is too dark, we can boost brightness with the following simple expression:
Port Moody, Greater Vancouver
Note that this method should be used cautiously - if there are bright areas in the image, they will reach or exceed the maximum value (255 in my example), which will make them purely white (255, 255, 255 in case of RGB24), and the information in those areas will be lost.
- See BrightnessCorrection.fmwt in the attached zip file
If one of the colors on an image seems to dominate over the others, we can change only one band (or apply different coefficients to different bands):
- See ColorCorrection.fmwt in the attached zip file
Color to Grayscale Conversion
Most internet sources suggest the following formula for color to grayscale conversion (and many sources also mention that depending on the image it may vary):
0.2989*A + 0.5870*A + 0.1140*A
The workspace also makes an image based on calculating average values,
0.3333*A + 0.3333*A + 0.3333*A
but the first formula gives better contrast.
- See RGB2Grayscale.fmwt in the attached zip file
If we inspect results in Visualizer, we will see the results of the conversion:
- See UnitConversion.fmwt in the attached zip file
Suggested Similar Articles
These examples demonstrate how to use conditions in the RasterExpressionEvaluator to isolation and perform operations on specific band values in a raster.
Several examples of how the RasterInterpretationCoercer can help you optimize your raster data for display or further processing.
Learn how to apply color to point clouds from a raster images and manipulate the color values to highlight features.
Introduction into Minecraft world making with FME 2015
Replaces the geometry of input raster features with a polygon covering the extents of the raster. In this example, it is used to support vectorization of an input DEM into classified elevation vector polygons.