IT

Laser scanning, SLAM and LiDAR · 26 October 2019

Cleaning a point cloud of noise, clutter and duplicate points

Three tools CloudCompare offers to clean a point cloud of clutter, noise and duplicate points: Remove Duplicate Points, SOR Filter and Noise Filter.

Clicking loads the video from YouTube: Google will receive your IP address and may store data on your device. Privacy · Watch it on YouTube

In this article I’ll talk about three tools that the open source software CloudCompare offers to clean a point cloud of clutter, noise and duplicate points.

They are:

  • Remove duplicate points;
  • SOR Filter;
  • Noise Filter.

Cleaning a (photogrammetric) point cloud

A photogrammetric survey doesn’t end with the generation of the dense point cloud.
There’s more!

If you get a perfect cloud as output, ready to use to correctly extract all the information you need (sections, digital elevation models, contour lines, …), do write to me!
I’d love to know how you do it!

All my photogrammetric clouds need some work to:

  • remove excess parts that aren’t in the actual survey area;
  • remove points that have nothing to do with anything, but were generated by the photogrammetry software;
  • separate ground points from vegetation and other things on the ground (cars, buildings, …).

How much work does it take?
Well, it depends on the complexity and quality of the cloud.
From half an hour or so (in the smallest, simplest and luckiest cases) to many hours (when everything is difficult and the output has to be looked after obsessively).

In this article I’ll talk about how to tackle the second of the three points above.

Clutter, noise and duplicate points

Clutter and noise are made up of points that the photogrammetry software processed and generated, but that don’t represent anything physically present on the ground (or on the surveyed object) when the photos were taken.

They have to go.
They’re “production errors”.
And sometimes they can even be dangerous!

In fact, if you trace the envelope of the points of a section (I talked about it in this article) extracted from a point cloud with lots of noise, there’s a real risk that the profile polyline passes through the clutter points and gives a wrong representation.

There are various reasons why you end up with this stuff under your feet.
Here are a few:

  • low-quality processing of the dense cloud in the photogrammetry software;
  • no filtering during cloud generation, again in the photogrammetry software;
  • particular lighting conditions when the photos were taken (flare, the glare in a photo shot into the sun, tends to produce a lot of clutter in the output);
  • complex objects with elements on several planes (a high-voltage power line pylon);
  • front-facing (or in any case non-nadir) photos of objects against “problematic” backgrounds (the sky, a green hillside, …).

The photogrammetric process can only work with what it finds in the images.
It does its best, but beyond a certain limit it just can’t cope!

The “passive” principle of photogrammetric processing is also responsible for duplicate points in a cloud.
They’re separate points with practically the same coordinates (x,y,z).
They are, in effect, on top of each other, and they add no useful information to the point cloud.
In fact, if there are many of them, they weigh it down!

Laser scanner measurement is less affected by these problems.
The “active” measuring principle greatly reduces clutter, noise and duplicate points.
I’m not a laser scanning expert, but the cloud generated after the scans should be cleaner than the photogrammetric cloud of the same object.
If you use a laser scanner, you can help me out on this!
🙂

Mobile LiDAR measurement is a different story: LiDAR on UAVs and on inertial (backpack) systems.
There’s more noise and clutter to remove there…

Three automatic tools

Having told you what clutter and noise in a point cloud are, I’ll show you how to remove them with three simple tools that CloudCompare provides:

  • Remove duplicate points;
  • SOR Filter, the statistical outlier removal filter;
  • Noise Filter, the noise reduction filter.

As often happens, I have good news and not-so-good news.

Let’s start with the good.

All three tools are automatic.
They’re fast and don’t require long, repetitive actions on your part.

And now the not-so-good.

They don’t always work 100%.
Don’t expect your cloud to be perfect at the end of the automatic cleaning.
It won’t be.
Something will have slipped through.
And you’ll need to step in manually.
In any case, most of the work will have been done by the three lads I’m about to introduce.

Remove duplicate points

The Remove Duplicate Points command does something simple: it reduces the number of points in a cloud so that none are closer than a minimum distance.
But be careful not to use it to lighten a point cloud you think has too many points.
For that it’s better to use the algorithms of the Subsample command.
They work much better!

Choose Remove Duplicate Points to do exactly what its name says: remove points that are effectively on top of each other, lightening the cloud by eliminating information that serves no purpose.

You’ll find it under Tools, Other, Remove duplicate points.

It’s the simplest of the three tools in this article.
And the first one I “run” on a new cloud to treat.

When it starts, a window appears where you choose just one thing: the minimum distance between points in the new processed cloud (Minimum distance between points).

The Remove Duplicate Points tool

By default, CloudCompare proposes a very, very low value.
As an engineer used to “practical” numbers, I’d be tempted to call it “absurd” and meaningless.
But if you think about how the algorithm works and what it’s for, it does make sense.

If the minimum distance were zero, the process might not work effectively.
And “0” isn’t a value that filters and automatic processes like much.

Such a low value (practically zero) ensures that both genuinely overlapping duplicate points and extremely close ones are removed!

I suggest giving this command a chance with the default settings.

In my case, about 1,200,000 points (almost 10% of the total) disappeared from the cloud I used for these screenshots!
Not bad!

A point cloud before removing duplicate points

A point cloud after removing duplicate points

Increasing the minimum distance will tend to remove more points.
I’ll leave the tests on your specific case to you (every cloud is different).
I’ll just warn you not to push the decimals too far, at the risk of removing elements that are significant.

The command (like all those in this article) is non-destructive.
The original cloud isn’t modified: the software generates a new one.

SOR filter

The second tool I use to clean a point cloud is the SOR Filter.

S.O.R. stands for Statistical Outlier Removal.

Outliers are points that occupy wrong positions in 3D space, somewhat away from the rest of the point cloud.

They’re errors of the photogrammetric processing.
I’ve had outliers behind a cliff or under a road!

There are never many.
But there often are some.
And the job of the SOR filter is to find them and remove them.

The algorithm is a little more advanced (though still simple) than the duplicate removal one and is based on a statistical approach.

You’ll find the command under Tools, Clean, SOR filter.
And this is what you see when you launch it.

The SOR Filter tool

You have to choose two parameters.
And the filter does two things.

1) Calculating the mean distance between points

For each point of the cloud, it calculates the mean distance to its neighbouring points.

You decide how many neighbours the software considers to calculate the mean.
It’s the tool’s first parameter (6 by default).

In other software (and here too, as you’ll see shortly) you may find it as Knn (k nearest neighbours).

2) Calculating the threshold distance

Once the tool has calculated, for each point, the mean distance to its neighbours, it calculates a threshold distance on which to decide whether a point is an outlier (and should therefore be removed) or not.

The formula is also shown in the tool’s window.
The threshold equals the mean distance (calculated in the previous step) plus the standard deviation of the distances to the neighbours multiplied by an “nSigma” factor.
That multiplier is exactly what you choose.
By default it’s “1”.
The smaller the threshold, the more points will be removed as outliers.

As you can see, this filter isn’t complex either, but its two parameters let you try quite a few more combinations to automatically remove as many outliers as possible without removing significant points.

Here’s a close-up of my cloud from which the filter removed, well and with the default values, some outliers.

A point cloud with outliers

A point cloud after applying the SOR Filter

But I really can’t tell you to stop at the default values!
Default doesn’t always mean best.

Point clouds are so different (if only in the object modelled) that stopping at the values the software proposes risks missing the chance to tune the filter to your specific case.

Try various combinations of values.
Change one at a time.
They’re fairly intuitive.
If you increase the number of neighbours, you improve the statistical calculation of the mean.
But if you use too many and the cloud is noisy, you risk including clutter points in the mean and getting a “wrong” value.

This tool is non-destructive too.
You can’t do any harm!

And it’s fast even with tens of millions of points.

A few tests really take little time and can lead you to a better result.

In short, try!
🙂

Remove noise with the Noise filter

And here’s the last of the three tools in this article.
It’s the slightly more complicated one (but still simple): the Noise Filter.

This one too is under Tools, Clean, Noise filter.

Before telling you how it works, I’ll try to explain what’s meant by noise.
With an example.

Imagine you’ve modelled a road with photogrammetry.
You have a point cloud representing the asphalt surface.
Ideally, all the points of the cloud lie on that surface.
In reality, most of the points are there, but some will be above it and some below.
Those points are the noise.

Here’s the window you’ll see when you launch the tool.

The Noise Filter tool

Here there start to be a few more possible combinations of variables.
But don’t be scared.
This one’s easy too.

The Noise Filter is a bit like the SOR Filter, but the difference is real and not trivial.
The SOR Filter considers the distance between neighbouring points, while the Noise Filter considers the distance of the points from a reference surface.

The filter fits a local plane around each point of the cloud and then removes the points that are “too far” from that plane.
In effect it’s a low-pass filter.

To estimate the reference plane you can choose a radius or a number of neighbouring points.

If you choose the radius option (active by default), the software generates a sphere around each point and uses the points inside it to fit the reference plane.

With the points option, you decide how many points near the specific point to use to calculate the plane (there’s that Knn again).

Based on the cloud’s characteristics, for the radius option the software already proposes a radius it considers sensible.
Everything I wrote for the SOR Filter applies here too: try different parameters!
If you choose the radius option, make sure the value is large enough to include at least 6 points inside the sphere.

The second decision you can/must make with this tool concerns the maximum error: the parameter that determines whether a point is considered noise (and removed) or not.
It’s the same idea as the threshold in the SOR Filter.
Here you can choose a relative error (as a multiplier of the reprojection of the neighbouring points onto the fitted plane) or an absolute one.
Personally, I think the first works better.

A point cloud with noise

A point cloud after noise reduction

Of the three tools for cleaning a point cloud, the Noise Filter is the most delicate.

It’s formidable on flat surfaces.
Less so on curved ones (like the one in the screenshots above).
Even less on edges and corners.

It’s also the tool with the highest risk of removing “good” points.
So keep your eyes open!

It may be worth doing some tests (nothing new there!) or splitting the cloud according to its characteristics and applying the Noise Filter differently to each part.

(Unfortunately) it doesn’t end here

These three tools are a great help in editing a point cloud to get clean, sensible data consistent with the reality of the modelled object.
But, as I wrote at the start, they almost certainly won’t be enough.
You’ll probably still have some work to do to refine the final data.

So it’s time to roll up your sleeves, be patient and carry on by hand.

I suggest the cross-section method.
The same one you can use to remove vegetation or separate man-made elements from the ground.
I talked about it in this blog article.

It can be long (it certainly will be), repetitive and not much fun.
The effort and time depend on the characteristics of your cloud.
In any case, I think it’s an appropriate and necessary procedure.

A photogrammetric survey (never) ends with the generation of the point cloud!
🙂

You can also watch my videos

I published three videos on the YouTube channel where I show, sharing my screen, how these tools work. The videos are in Italian.

For doubts or questions, write to me on Telegram, @paolocorradeghini, or from the contact page.

Paolo Corradeghini

← All articles