- Applying color to a point cloud
How does it work?
The PointCloudOnRasterComponentSetter receives two sets of input features, PointCloud and Raster, which must be in the same coordinate system and units.
For each point in the point cloud, component values are set by extracting raster band values from the same location in the underlying raster. These values are interpolated if necessary, and a variety of interpolation methods is available. The extracted values are added to the point’s components as specified - either color (color_red, color_green, color_blue) or a Custom set of components, in which you may select any standard point cloud component to receive raster cell values (including color).
Point cloud features are output with new component values set, and rasters are discarded.
This transformer accepts multiple input point clouds and rasters. One point cloud is output for each input point cloud.
If multiple rasters are used, the component value will be taken from the first raster encountered that can provide one, and so the order of input for rasters can affect the results. If a point does not overlap a raster, the next raster will be tried, and so on until a value is obtained.
Rasters must have the same number of selected bands as there are components selected. For color, three bands are required - red, green and blue. A RasterSelector transformer may be used to meet these conditions - for example, an RGBA raster (color with an additional alpha band) would need to have only its first three bands (RGB) selected to be successfully used with the Components to Set - Color option.
This transformer supports raster band selection. The RasterSelector can be used to modify this selection.
In this example, we will apply color to a LiDAR point cloud using an orthoimage. As seen here in the FME Data Inspector, the point cloud partially overlaps the underlying orthoimage - the point cloud coverage ends at the shoreline. This view shows an overhead (2D) view of both datasets, the point cloud overlaid on the raster.
Note that the point cloud has a number of standard components, but that does not include color.
Both input features are routed into a PointCloudOnRasterComponentSetter - the point cloud (from LAS format) to the PointCloud input port, and the orthoimage (from MrSID format) to the Raster input port.
In the parameters dialog, we select the Components to Set as Color. Other parameters are left with their default settings.
The output point cloud now has color values in the color_red, color_green, and color_blue components.
- The PointCloudOnRasterComponentSetter may be useful to transfer data values when handling non-point cloud data types as point clouds for processing efficiency.
Choosing a Point Cloud Transformer
FME has a selection of transformers for working specifically with point cloud data.
For information on point cloud geometry and properties, see Point Clouds (IFMEPointCloud).
Combines features into a single point cloud. Point cloud and non-point cloud geometries are supported.
Adds new components with constant values to a point cloud.
Copies selected component values onto either a new or existing component
Keeps only specified point cloud components, discarding all others.
Removes specified components from a point cloud.
Renames an existing component.
Alters the data type of point cloud components, and converts component values if required.
Reads point cloud features for testing purposes, including any accumulated point cloud operations. No additional operations are performed, and nothing is done with the features.
Creates a point cloud of specified size and density, with default component values.
Evaluates expressions on each point in a point cloud feature, including algebraic operations and conditional statements, and sets individual point cloud component values.
Serializes the geometry of a point cloud feature into a Blob attribute, encoding the contents according to a choice of common binary point cloud formats.
Separates point clouds into multiple features, based on evaluating expressions including component values, and creates a separate output port for each expression defined.
Merges point clouds by joining points where selected component values match (join key), including x, y, z, and other components. Component values are transferred between point clouds and output is filtered based on matching success and duplication.
Sets point cloud component values by overlaying a point cloud on a raster. The component values for each point are interpolated from band values at the point location.
Extracts the geometry properties of a point cloud feature and exposes them as attributes, optionally checking for their existence, retrieving component properties, and finding minimum and maximum values. Extents may also be recalculated and updated.
Decodes a binary attribute containing encoded point clouds stored as Blobs, replacing the feature’s geometry with the decoded point cloud.
Reduces the number of points in a point cloud by selectively keeping points based on the shape of the point cloud. The simplified and removed points are output as two discrete point clouds.
Sorts the points within a point cloud by one or more component values.
Separates point clouds into multiple features based on component values, color, or first/last return.
Calculates statistics on point cloud components and adds the results as attributes.
Takes an input point cloud and reconstructs it into an output mesh.
Reduces the number of points in (thins) a point cloud by keeping points at a fixed interval, a maximum number of points, or a set quantity of first or last points. Remaining points are discarded.
Converts point clouds to point or multipoint geometries, optionally retaining attribute and component values.
Applies a point cloud’s scale, offset, or transformation matrix to it, recalculating component values and removing the transformation values.
Point cloud features to overlay on the Raster input. Both Raster and PointCloud input should be in the same coordinate system.
Raster(s) from which values will be extracted. Both Raster and PointCloud input should be in the same coordinate system.
Point cloud features with updated component values.
Non-point cloud features will be routed to the <Rejected> port, as well as invalid point clouds.
Rejected features will have an fme_rejection_code attribute with one of the following values:
Rejected Feature Handling: can be set to either terminate the translation or continue running when it encounters a rejected feature. This setting is available both as a default FME option and as a workspace parameter.
If Group By attributes are selected, features with the same values in the Group By attributes are grouped together, and rasters are only used to set component values of point clouds in the same group.
Select the point in processing at which groups are processed:
Considerations for Using Group By
There are two typical reasons for using When Group Changes (Advanced) . The first is incoming data that is intended to be processed in groups (and is already so ordered). In this case, the structure dictates Group By usage - not performance considerations.
The second possible reason is potential performance gains.
Performance gains are most likely when the data is already sorted (or read using a SQL ORDER BY statement) since less work is required of FME. If the data needs ordering, it can be sorted in the workspace (though the added processing overhead may negate any gains).
Sorting becomes more difficult according to the number of data streams. Multiple streams of data could be almost impossible to sort into the correct order, since all features matching a Group By value need to arrive before any features (of any feature type or dataset) belonging to the next group. In this case, using Group By with When All Features Received may be the equivalent and simpler approach.
Note Multiple feature types and features from multiple datasets will not generally naturally occur in the correct order.
As with many scenarios, testing different approaches in your workspace with your data is the only definitive way to identify performance gains.
Components to Set
Specifies which point cloud components should be set from the corresponding raster(s).
If Components to Set is Custom, select components to be set:
Extract Raster Nodata
Specifies the behavior when a point lies on a raster Nodata value.
Default Values Overwrite Data
Specifies the behavior when no value can be found for a point from any raster, but the component already existed on the input point cloud.
Cell values are interpolated to arrive at point cloud component values. Select an interpolation method for determining values:
Editing Transformer Parameters
Using a set of menu options, transformer parameters can be assigned by referencing other elements in the workspace. More advanced functions, such as an advanced editor and an arithmetic editor, are also available in some transformers. To access a menu of these options, click beside the applicable parameter. For more information, see Transformer Parameter Menu Options.
There are several ways to define a value for use in a Transformer. The simplest is to simply type in a value or string, which can include functions of various types such as attribute references, math and string functions, and workspace parameters. There are a number of tools and shortcuts that can assist in constructing values, generally available from the drop-down context menu adjacent to the value field.
Using the Text Editor
The Text Editor provides a convenient way to construct text strings (including regular expressions) from various data sources, such as attributes, parameters, and constants, where the result is used directly inside a parameter.
Using the Arithmetic Editor
The Arithmetic Editor provides a convenient way to construct math expressions from various data sources, such as attributes, parameters, and feature functions, where the result is used directly inside a parameter.
Set values depending on one or more test conditions that either pass or fail.
Expressions and strings can include a number of functions, characters, parameters, and more.
When setting values - whether entered directly in a parameter or constructed using one of the editors - strings and expressions containing String, Math, Date/Time or FME Feature Functions will have those functions evaluated. Therefore, the names of these functions (in the form @<function_name>) should not be used as literal string values.
|These functions manipulate and format strings.
|A set of control characters is available in the Text Editor.
|Math functions are available in both editors.
|Date and time functions are available in the Text Editor.
|These operators are available in the Arithmetic Editor.
|These return primarily feature-specific values.
|FME and workspace-specific parameters may be used.
|Creating and Modifying User Parameters
|Create your own editable parameters.
Dialog Options - Tables
Transformers with table-style parameters have additional tools for populating and manipulating values.
Enabled once you have clicked on a row item. Choices include:
Cut, Copy, and Paste
Enabled once you have clicked on a row item. Choices include:
Cut, copy, and paste may be used within a transformer, or between transformers.
|Start typing a string, and the matrix will only display rows matching those characters. Searches all columns. This only affects the display of attributes within the transformer - it does not alter which attributes are output.
|Import populates the table with a set of new attributes read from a dataset. Specific application varies between transformers.
Generally resets the table to its initial state, and may provide additional options to remove invalid entries. Behavior varies between transformers.
Note: Not all tools are available in all transformers.
The FME Community is the place for demos, how-tos, articles, FAQs, and more. Get answers to your questions, learn from other users, and suggest, vote, and comment on new features.
Search for all results about the PointCloudOnRasterComponentSetter on the FME Community.
Examples may contain information licensed under the Open Government Licence – Vancouver and/or the Open Government Licence – Canada.
Keywords: point "point cloud" cloud PointCloud coerce LiDAR sonar expose extract extents orthophotos PointCloudOnRasterValueExtractor