Classifying point clouds with CGAL

There exist all sorts of interesting point cloud classification approaches, many of them open source and accessible. A set of particularly interesting ones have been released recently via the Computational Geometry Algorithms Library, or CGAL. The description of the CGAL from their web page is as follows:

CGAL is a software project that provides easy access to efficient and reliable geomeric algorithms in the form of a C++ library. CGAL is used in various areas needing geometric comutation, such as geographic information systems, computer aided design, molecular biology medical imaging, computer graphics, and robotics.

Built into their latest releases are some pretty interesting approaches to quick and accurate point cloud classification which I have been itching to try out (HT Piero Toffanin of Masserano Labs / WebODM founder).

Image of 3 classifications of the same point cloud using CGAL
Image of 3 classifications of the same point cloud using CGAL

I will confess: with my generalist bent for software, I was a little worried whether I could get to the stage of testing the software. What follows is my process, which was surprisingly straightforward.

A picture of a yak in the Himalayas

First we clone the CGAL repository into it’s own subdirectory, then we checkout the appropriate release, set up our build directory, and make and install the whole project:

So far so good. On the CGAL page on classification approaches, they have full code examples for use of the libary. We do a quick search for the code examples in our code base and built them:

Now we can run an example:

What did we just do? We took raw data as below:


And training data separating out building (pink), ground (tan), and vegetation (green):


And thus ran the through CGAL’s best classification approach to get the following classified point cloud:


Pretty cool! And the results look really good. Next I’ll try it on some drone data, and see how we do.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.