Cleaning a point cloud in CloudCompare
How I clean a photogrammetric point cloud in the open source software CloudCompare: manually, slice by slice, and automatically with the CSF 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 tell you how I clean a point cloud using the open source software CloudCompare.
Cleaning a point cloud
Photogrammetry and laser scanning let you capture 3D data with a very high density of information.
The main output of these surveys is point clouds.
The points of a (dense) cloud are really close to one another and let you characterise what you surveyed with a wealth of data unthinkable with “classic” survey methods (total station and GNSS).
However, you can’t take all the points of a cloud “at face value”.
They have to be looked at, treated and filtered, to remove information that’s irrelevant to the purposes of your work.
Or even wrong!
If you’re doing a topographic survey and your aim is to describe the ground, the points on trees or bushes aren’t data to keep.
If you have to describe the terrain of a quarry area, to then make sections and profiles, an excavator parked in a yard or the site huts aren’t to be taken as valid.
They aren’t ground.
A photogrammetric or laser scanner survey lets you reconstruct in 3D whatever was in the scene when the photos or scans were taken.
Nothing excluded!
Plants, cars, buildings, power line pylons, site set-ups, plant and machinery.
They’ll all be part of the final output point cloud.
But if you want to get to the ground and deliver consistent data, you have to remove them.
That’s why it’s really important to know how to clean a point cloud!
Cleaning a photogrammetric cloud
In this article I’ll show you a practical case of cleaning a point cloud from an aerial photogrammetric survey.
I’m not an expert in laser scanning and I’d rather talk about cases I deal with regularly in my work.
If you’d like to contribute your laser scanning (or photogrammetric) experience to this discussion, I’d be really glad to add it!
At the end of the article I’ll tell you how to get in touch.
The data in this example is a point cloud of a fairly small area in Sicily, surveyed by Leonardo Engineering and Research.
Thanks to Enrico Noto and Domenico Santici (Technical Director of Leonardo Engineering and Research) for sharing the data and allowing me to publish it here!
I chose to work on a point cloud I didn’t process myself.
And for which I didn’t even do the field acquisition.
Neither photos nor measurements.
It’s a rural area of just under 4 hectares of gently sloping ground with some scattered vegetation.
The cloud has 9,000,000 points and is a “downgrade” of an original dataset of 15,000,000 points.
I wrote an article on how to simplify a point cloud in CloudCompare, which you’ll find at this link.
Below is an image of the original point cloud to be cleaned.

Manual and automatic cleaning
There are two ways to clean a point cloud: an automatic one and a manual one.
The automatic method relies on software algorithms that recognise the characteristics of the point cloud and tell the ground apart from what’s on it.
It’s fast, almost instant.
The manual method relies on the experience and judgement of the operator, who decides, area by area, what to keep (ground) and what to remove (everything else).
It isn’t fast at all.
Put like that, there seems to be no contest: keep the automation and send the manual method home.
But I think it’s much wiser to consider both methods for every case.
The automatic method doesn’t always work.
The software divides the ground into cells of a given size.
For each cell it identifies the lowest and highest points.
Then it tries to work out what the ground is, following various approaches.
In some cases it also uses information from the colour of the points (RGB).
Each program has its own filtering method.
Some are effective in certain scenarios, others work better in others.
But it’s always an automatic process, with no guarantees.
There are a great many variables at play!
And sometimes it doesn’t work well.
And, above all, it always has to be checked.
The manual method works like an X-ray.
The operator analyses the point cloud bit by bit and decides what’s fine and what isn’t.
If the point cloud is large or the ground is complex, treating it all can take quite a while.
But you’re unlikely to run into the software’s automatic misjudgements, and the result will be “valid”.
I think it’s very useful to know how to clean a point cloud manually, and that’s why most of this article is about exactly that.
In my work I find myself treating point clouds manually much more often than automatically.
And now I’ll tell you how I do it.
CloudCompare
CloudCompare is very well made open source software, widely used, functional and fairly “powerful”.
It was born to compare point clouds from laser scanner surveys but has grown over time with tools and plugins, some of them advanced.
I use it a lot to treat the results of drone photogrammetric surveys.
In fact, since I got to know it and started exploring it properly, I spend less and less time in photogrammetry (structure from motion) software and more and more time in CloudCompare.
Being open source, with a huge online community behind it (where you can look for and find information, tutorials and answers to doubts and questions), makes it, in my view, software to install and use!
Another important point is that CloudCompare can export files in many formats (dxf, las, tif, shp, asc, txt…), making exchange with the other software you use in your work easier.
Cleaning a point cloud with cross-sections
Manually cleaning a point cloud in CloudCompare uses cross-sections to work more effectively and comfortably.
I learnt this method on a training course organised by the Genoa company Gter and taught by Ilaria Ferrando, of the Geomatics Laboratory of the Engineering Faculty of the University of Genoa.
Since what you have to remove are elements that rise vertically above the ground, the best view for working on the point cloud is a side view.
However, unless you have a perfect inclined plane, when you rotate the model to a side view you probably won’t be able to see the trees or buildings to remove clearly.
A hollow, a bump, a concavity or a convexity mix the good points with the bad ones, and it becomes really hard to make the selections correctly without risking removing points you should keep.
If instead you “slice” a point cloud, you can work on the individual slices, thicker or thinner (depending on how complex the case is), and remove the points that aren’t ground more easily.
I wrote two articles on using CloudCompare to make cross-sections from point clouds.
You’ll find them at these links: a cross-section from a point cloud, cross-sections with CloudCompare.
For the purposes of this article, the first of the two will be more useful.
Slice the cloud
The first step is to cut the model into slices.
With the cloud selected, go to Tools, Segmentation, Cross Section.
Using the arrows (green, blue and red), shrink the yellow box until you have a section oriented in the way you think is best for cleaning it.
If you’re working on a slope, it’s typical (and recommended) to orient the sections along the line of steepest slope.
The width of the section matters too.
A very wide section may not be ideal for cleaning the point cloud well, especially if the ground inside it isn’t uniform.
A narrow section is certainly better, but it means that, for the same area, you’ll have to work on a large number of sections.
And since you’ll have to treat them all individually, there’s a real risk that the overall processing time will grow a lot.

Once you’ve found your best section (you don’t need to start from one end of the point cloud; in fact I suggest sectioning it in the area most representative of the elements to remove), you have to cut the whole model into slices with the same orientation and thickness.
You do this by clicking the button I’ve highlighted in the image above.
It’s the right-hand icon of the Slices option.
In the new window that opens, it’s important to set the Gap value to “0”.
That way you generate adjacent sections and don’t leave out any part of the point cloud (which you’ll have to treat afterwards).

Once the cloud is sliced, it will look as though everything is back to how it was.
You won’t see any change in the main window.
In fact, if you look at the DB Tree window, you’ll see a new folder with the suffix .slices containing lots of new elements.
Each of these is a point cloud and corresponds to one of the sections you created.

If you hide a few of them, you’ll see what has happened.

Careful!
To see the slices you’ll have to hide the original point cloud, which stays at the top of the DB Tree.
If you leave it visible, it covers everything underneath!
Clean section by section
Now that you’ve sliced the whole point cloud, you have to start cleaning section by section.
Hide all the sections and leave visible the first one you’ll work on.
Switch to a side view (from which you can see the elements to remove clearly) and launch Edit, Segment.
The Segment tool
Before showing you how to clean each section of the points that aren’t ground, a few words on the Segment tool.
Its icon is a pair of scissors.
As soon as you launch it (remember to select the point cloud you want to treat in the DB Tree panel), a polygonal selection tool is already active.
And at the top right of the main window there’s a small toolbar.

Clicking with the mouse along the vertices of a polyline you choose, around the element you want to remove, you draw its boundary.
When you’ve finished, right-click to end the selection.

Now you have two options: Segment In or Segment Out.
Segment In keeps visible the area inside the polygonal selection and hides everything else.
Segment Out does the opposite.
Since this operation doesn’t destroy any point of the cloud, I’ll leave it to you whether to use Segment In or Out.
I always use Segment Out because I find it much more practical when cleaning a section.
Below is the result of Segment Out.
I suggest trying both, to see which way you prefer working.

Once you’ve made your choice, you can still make further selections.
The Segment tool is still active.
You can navigate the model with the usual tools (pan, zoom, rotate) to move to another area to clean.
The polygonal selection (active when you first opened the tool) is now paused, and to reactivate it you click the button with the pause icon.
Make a new selection and choose Segment In or Out again.
When you’ve cleaned everything, click the green tick to confirm.
If you want to cancel the selections you made, click the red “X”.
Be careful, because, as far as I know, CloudCompare doesn’t have a general “Undo”: there’s no CTRL+Z.
But at least none of its commands is destructive.
When the selection is done, you’ll see two new point clouds in the DB Tree panel, both visible.
They have the same name as the original cloud plus a .remaining suffix and a .segmented one.
Depending on your choice of Segment In or Out, one of the two clouds will be the part to keep and the other the part to remove.

These steps may seem a bit convoluted and not simple.
They aren’t, really.
It just takes getting the hang of it the first few times, but I assure you it all becomes easy.
Try it on a test file before working on a real job.
Work on each section
Now that you’ve seen how the Segment tool works, it’s time to apply it to each section.
As you can see from the images below, in a section seen from the side you can spot and select the elements to remove well.
With little risk of selecting ground you want to keep.

I always use Segment Out, because that way the points to remove disappear from view and I can go on removing others in the same section, or refine the cleaning of an area already treated.

Once the polygonal selection is active, you can’t move around the model or change the view.
So I suggest getting into a comfortable view first, to see everything you need to select clearly, and only then reactivating the selection with the pause button.
Another tip is to organise the work in folders (which you can also create in the DB Tree window), so that for each section you separate the ground points from the elements to remove.
If you have many sections, there’s a real risk of creating quite a mess among the layers and spending a lot of time showing and hiding them almost at random!
You can also clone point clouds (to make copies, if you like) with Edit, Clone.
All this helps keep your project organised and tidy.
I guarantee, because I’ve been there dozens of times, that it’s very easy to lose control and end up with layers and clouds spilling off the screen!
And it takes time to put everything (or nearly everything) back in order.

When you’ve finished one section, move on to the next.
Don’t delete, classify!
So far I’ve written about treating the point cloud to remove what isn’t ground.
But since CloudCompare doesn’t throw anything away, it may be better to classify what isn’t ground.
That way you can separate shrubs from trees, buildings from site set-ups, cars from overhead power lines.
If you create a folder for each type of element above the ground in your cloud, you can keep them in your data and use them as you like when needed.
Classification takes a bit longer than a simple split between ground and non-ground, but I think it’s more rigorous and helps organise the project even better.
I’ll leave it to you which way to go.

DEM and contour lines from a cleaned cloud
If you’ve organised the project elements tidily, at the end of the whole process you should have all the sections cleaned.
I mentioned the Clone command earlier, but now it’s important to use another Edit command, Merge.
It joins two or more point clouds into a single new cloud, and I suggest selecting all the cleaned section clouds and merging them.
You do it with Edit, Merge.
Before and after
Below are two images of the point cloud before processing and after the manual cleaning.
The black patches you see in the cleaned cloud are the shadows of the tree crowns cast on the ground.
There, the points are darker than the ones around them.


As you can see, the cleaned point cloud is more “holey” where you removed the elements that weren’t ground.
Watch out for this, especially with point clouds from photogrammetry (which is a passive survey technique).
The quality of the starting data (the original cloud) is really important if cleaning the point cloud is to leave you with something valid.
And the quality of the data comes from good photogrammetric processing but, even before that, from the fieldwork (photos and measurements).
The example in this article is a simple case and the cleaning left few holes, but there are situations where it might not be easy to “reach the ground”.
In some cases I’d say it’s impossible, or at least not worth it.
If you have a point cloud of dense woodland surveyed with nadir aerial photogrammetry, cleaning it will be a lost cause (with either the manual or the automatic method)!
DEM – Digital Elevation Model
But back to our example.
If you managed to clean a point cloud leaving only the ground, you can generate a Digital Elevation Model (DEM) that will look a lot like a DTM (Digital Terrain Model).
I won’t dwell on this because I’ve already written about it in other articles.
If you want to understand the difference between the various digital elevation models, there’s an article at this link.
If instead you want to know how to generate a Digital Elevation Model and contour lines in CloudCompare, I wrote about it here.
I’ll just add that, if the holes are small relative to the overall area, you can interpolate the digital elevation model inside them (letting CloudCompare generate it) to get uniform information.
You won’t make any gross errors.
If instead you have larger holes, it’s better to use specific survey measurements taken in those very areas with other methods and instruments (total station or GNSS antenna).
Contour lines
I think the difference between a cleaned cloud and a “dirty” one shows clearly in the contour lines.
Contour lines are curves joining points on the ground at the same height.
At this link you’ll find an article I wrote some time ago.
Contour lines refer ONLY to the ground and are calculated by height interpolation from its points.
If you have software generate contour lines from a point cloud that also contains trees, cars and buildings, what you get out is wrong data, because it takes into account not only the ground but also what’s on it.
In my view it’s a really serious mistake to deliver a plan with contour lines that draw the trees.
It isn’t a topographic output.
Below are the contour lines created from the original cloud and from the cleaned one.
The lines were generated by discretising the ground with a 1-metre grid digital model and are 1 metre apart.


And here’s the same thing, but with contour lines generated from a 5-metre grid DEM (in the hypothetical case of a smaller-scale drawing).
The first image again refers to the uncleaned cloud.


Automatic cleaning
If you’ve read this far, thank you!
If you skipped the whole part on manual cleaning and came here straight after the introduction, I understand!
🙂
Now I’ll tell you how you can try to clean a point cloud automatically.
Since this whole article has been about CloudCompare, I’ll stick with it for automatic cleaning too.
Photogrammetry and point cloud software each handle point filtering and cleaning in their own way, so what I’m writing applies only to CloudCompare.
If you’ve used these procedures in other software, I’d really like to hear your feedback and thoughts!
The CSF filter
CloudCompare offers a good plugin for extracting ground points from a cloud.
It’s called CSF, Cloth Simulation Filter, and it’s based on the scientific paper An Easy-to-Use Airborne LiDAR Data Filtering Method Based on Cloth Simulation by Zhang W., Qi J., Wan P., Wang H., Xie D., Wang X. and Yan G., published in Remote Sensing in 2016 and freely available on the publisher’s website.
You’ll find it in the Plugins menu.
You can choose between two options: rely on the default parameters for the type of terrain, in the General parameter setting tab, or enter your own parameters in the Advanced parameter setting tab.
For the cloud in this post, the default parameters for the Relief scene didn’t work well at all.
Below is the result, showing the points that, according to the plugin, aren’t ground.
The default parameters are:
- Cloth Resolution: 2.0;
- Max Iterations: 500;
- Classification Threshold: 0.5.

If you judged the plugin’s effectiveness on the default parameters, in this case the mark would be dreadful!
However, by changing (lowering) the Cloth Resolution and Classification Threshold values you get better results.
Below is the result with:
- Cloth Resolution: 1.0;
- Max Iterations: 500;
- Classification Threshold: 0.2.
It still isn’t satisfactory, because it includes quite a few ground points in the selection.

And here’s a good compromise, obtained with:
- Cloth Resolution: 0.5;
- Max Iterations: 500;
- Classification Threshold: 0.1.
There’s still some excess here and there (see the yellow arrow), but overall the result is much better.

When the filter has finished, you’ll find a new folder in the DB Tree containing two point clouds, one called ground points and the other off-ground points, based on the automatic selection.
Below are the contour lines generated from the cloud cleaned with the CSF filter, from a 1-metre grid digital elevation model, 1 metre apart.
They’re fairly similar to those generated from the manually cleaned point cloud.

If you choose to use the automatic filter, I suggest a few attempts varying the default parameters to reach a solution that suits the scenario and the cloud you’re treating.
Once most of the data has been filtered, you can do a manual cleaning pass to check the whole model, area by area, more accurately.
After the first automatic sift you can, unless the terrain is unusual, use fairly thick slices.
The whole manual process should be quicker.
You can also watch a video where I cover manually cleaning and classifying a point cloud with CloudCompare. The video is in Italian.
I hope I’ve given you useful information for cleaning a point cloud of whatever isn’t ground.
Whether you did the survey yourself or received the data from someone who surveyed something on your behalf.
What I’ve shown you is my way of working.
It’s by no means certain that it’s the best, most effective or quickest.
Far from it!
That’s why I’d like to hear about your procedures, particular cases you’ve worked on, point clouds, the software you’ve used and the results you got.
If you have doubts, questions or specific observations on these topics, get in touch!
My favourite way is a message or voice note on Telegram, @paolocorradeghini, but any way you choose to contact me is fine. You’ll find my email address on the contact page.
Thanks for your time, and see you soon!
Paolo Corradeghini