Removing Noise in Point Clouds

Liz Sanderson
Liz Sanderson
  • Updated

FME Version

  • FME 2019.x

Introduction

Just like any data source, point clouds might need to be cleaned before they can be used. Occasionally, some point clouds contain noise such as clouds, birds, or other points that can skew your results. The noise can easily be removed by using a few transformers and FME tricks.

 

Step-by-step Instructions

In this example, we will be using a point cloud of a landscape that has clouds, which is noise.

 

1. Open FME Workbench

Open a blank FME workspace, and then add an ASPRS Lidar Data Exchange Format (LAS) reader. For the dataset, browse to the 000782.las dataset provided in the downloads.

 

Once the reader has been added, view the data set by clicking on the reader feature type to open the popup menu. Then on the popup menu, click on View Source Data to view the data in Visual Preview.

viewsourcedata.png

 

Then in Visual Preview, click on the Orbit button and drag the point cloud around until you can see the clouds above the ground. The clouds (shown in red) will be what we remove.

initialvisualpreview.png

 

2. Add a CoordinateSwapper Transformer

To remove the clouds, we will be creating tiles of the point cloud and removing and tiles that are empty or have the clouds in it. In order to do that, first we need to swap the coordinates. The Tiler transformer, which we will use in the next step, uses the X and Y axis, whereas the cloud elevation is stored on the Z-axis.

 

Add a CoordinateSwapper transformer, and in the parameters set the Swap Type to Y <-> Z.

 

3. Add a Tiler Transformer

Next, as previously mentioned, we will add a Tiler transformer and connect it to the CoordinateSwapper. In the Tiler parameters, set Tiling Type to Number of Tiles. Then for Horizontal Tiles set it to 1, and for Vertical Tiles set it to 25. The remainder of the parameters can be left as the default.

tilerparams.png

 

4. Swap Coordinates Back

Before we can do anything else, we need to swap the coordinates back. Duplicate the CoordinateSwapper, and connect it to the Tiler Tiled output port.

 

5. Run the Workspace

Run the workspace with Feature Caching enabled and inspect the output for the Tiler. In Visual Preview, you can see that we have rows 0 to 4, and 22 to 24. All the rows in between 4 and 22 are the empty space between the ground and the clouds. We need to add a null value for the empty space.

visualpreviewtable.png

 

6. Create the Null Rows

To create the Null rows, we will use a Creator and a FeatureMerger transformer. Add a Creator to the canvas, in the parameters set the Number to Create to 25. 25 is the number of tiles we created with the Tiler.

 

Next, add a FeatureMerger to the canvas, connect the Requestor input port to the second CoordinateSwapper, and the Supplier input port to the Creator.

featuremergerworkflow.png

 

In the FeatureMerger parameters, set the Requestor to _row and the Supplier to _creation_instance. Then set the Feature Merge Type to Attributes and Geometry. This will ensure our point cloud geometry is preserved throughout the workspace.

featuremergerparams.png

 

7. Add a Sorter Transformer

To ensure that the _row attribute will be in numerical order with the features we created with the Creator, we need to sort it. Add a Sorter transformer to the canvas and connect it to both the Merged and Unused Supplier output ports on the FeatureMerger.

sorterworkflow.png

 

In the Sorter parameters, set the Attribute to _creation_instance, Alpha/Num to Numeric, and the Order to Ascending.

sorter.png

 

8. Run the Workspace

Now run the workspace again and inspect the Sorter output port. You will see that _row is in numerical order with rows 5 to 21 having <missing> for the value. In the next steps we will remove all the <missing> rows and any rows after the <missing>, which contain the clouds.

sorted-vp.png

 

9. Add an AttributeCreator Transformer

We will be using two AttributeCreators to select the rows with <missing> and any rows after the rows containing <missing>.

 

Add an AttributeCreator to the canvas and connect it to the Sorter. In the parameters, create a new attribute called Remove and then for Attribute Value, click on the drop-down to open the Conditional Value dialog.

attributecreator.png

 

In the Parameter Conditional Definition dialog, double-click on the Test Condition box next to If. Then in the next dialog, set the test to _row Attribute is Missing, then set the Attribute Value to Delete.

conditional.png

 

Click OK three times to save the parameters for the AttributeCreator.

 

Next, add another AttributeCreator and connect it to the first one. Enable Adjacent Feature Attributes and then set the Number of Prior Features to 1. Create a new attribute called Remove, then open up the Conditional Value dialog.

attributecreator2.png

 

In the Parameter Conditional Definition dialog, double-click on the Test Condition box next to If. Then in the next dialog, set the test to feature[-1].Remove = Delete. Then set the Attribute Value to Delete. When we enabled Adjacent Feature Attributes, the feature[-1] became available, this will select all of the rows with a value of Delete.

conditional2.png

 

Click OK three times to complete the second AttributeCreator.

 

10. Test for Delete

Add a Tester transformer to the canvas and connect it to the AttributeCreator. In the Tester parameters, set the test to Remove != Delete. This will send any of the rows that we have set to Delete to the Failed output port on the Tester. If you run the workspace, five features should pass and the other 20 should fail.

tester.png

 

11. Clean up Attributes and Combine Point Cloud

One final step before we can write the data out is to remove any unnecessary attributes and combine the point cloud tiles.

 

Add an AttributeKeeper transformer to the canvas and connect it to the Tester Passed output port. In the parameters, set the Attributes to Keep to fme_basename.

 

Next, to combine the point cloud tiles, we will use a PointCloudCombiner transformer. Add a PointCloudCombiner and connect it to the AttributeKeeper. Since we didn’t modify the point cloud in any way except for removing points, we can leave the parameters as the defaults.

 

12. Run the Workspace

Finally, you can add your desired output format writer if you wish, and connect it to the PointCloudCombiner. Otherwise, run the workspace and inspect the PointCloudCombiner output port. We should have a single point cloud, with no (red) cloud noise.

finaloutput.png

 

 

 

Data Attribution

The data originates from West Virginia View. They are sponsored by AmericaView and the USGS.

Was this article helpful?

Comments

0 comments

Please sign in to leave a comment.