How to generate a height map with CloudCompare

This should give you the basics to generate a heat map of height for a 3D model (in this case a fossil dinosaur footprint), using CloudCompare (One of my top choices of freely available software*).
I’m going to assume you have a model correctly scaled, but not necessarily oriented to any specific world axis. The process involves importing the file, aligning it to a world plane, then colouring according to height from said plane.

Import

First up, import your model into cloud compare. I usually do this just be dragging the file into the main window, but the usual file->import will obviously work.  CloudCompare accepts most 3D formats of points or polygons.  After importing, it should look like this (your DB Tree may look slightly different if you have textures, or imported points).
hm1.jpg

Align to plane.

To colour by height, we need to know what we’re colouring from, i.e., what is horizontal, and what is zero?  To align our model to a horizontal plane, we’re going to fit a plane to the object.

Note: I’ve gone back and forth over the years about how accurate this should be – you might want to cut out an area around the foot of undisturbed sediment surface and base the horizontal on that, but to be honest, from experience it seems that just fitting a plane to the whole thing is ‘good enough’

To do this, make sure your object is selected in the DB Tree (that is, the node below the top one, either with a polygon or points logo, rather than a folder):
hm2.jpg
Then go to edit->plane->fit

hm3.jpg

This fits a plane (adding it to the DB Tree on the left), and in the Console describes the position of that plane (including translations and rotations).  We will use this to transform the original object to the horizontal:

hm4.jpg
Then I paste in the output into the transformation box and hit ok.

hm5.jpg

You can then check that it’s right by using the buttons on the left to view the object in 4 planar orientations:

hm6.jpg

Colorizing by height:

In order to colour by height and get a sensible scale, we need to export the Z (vertical) coordinates into a scalar field by going to Tools->Projection->Export coordinates to SF:

hm7.jpg

To explain what’s happening here, consider that every point in a point cloud, or every vertex in a mesh has an x, y, and z coordinate (and possible a Red, Green, Blue colour value, and maybe a x, y, z normal value).  This function creates a new value for each point and copies the Z-coordinate into it. Cloud Compare will ask which coordinate you want to export, and if you’ve been following along, you’ll want to select ‘Z’:

hm8.jpg

Dada! One height-mapped footprint:

hm9.jpg
You can turn the plane off by unticking it in the DB Tree, and you can show the colour-map scale by turning on the visible check box under ‘Color Scale’:

hm10.png

Your scale bar on the right should be in whatever units your model is in, and handily includes a histogram of frequency, so you can see how many points/vertices are above or below the level of the plane. Note that here, the plane still isn’t lying at 0.  To set the plane to 0, I’d just need to translate the footprint by -4.68 in the Z direction.

You can use other options in the SF Display Params on the left to change number of colour steps, or the range of colour etc:

hm11.jpg

You can then save images with Display->Render to File

hm12.jpg
*Please note that if you use CloudCompare commercially, or if a laser scanner company tries to fob it off on you instead of providing their own software, please support the developer.  Also: make sure to read this thread to see how to properly cite CloudCompare if you use it to generate figures for papers/talks/posters etc.
Advertisements

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s