Edit\Subsample

From CloudCompareWiki
Jump to navigation Jump to search

Menu / Icon

This tool is accessible via the 'Edit > Subsample' menu, or via the CcSampleCloud.png icon in the upper main toolbar.

Description

Subsamples a point cloud (i.e. decreases the number of points).

Several subsampling methods are available:

  • random number of points
  • random (percentage) since version 2.13
  • spatial
  • octree-based

Notes:

  • for each input cloud, a new subsampled cloud is created (the original one is simply deactivated)
  • a subsampled cloud is a subset of the input cloud (the original points are not displaced)
  • thanks to this, a subsampled cloud keeps the features of its source cloud (scalar fields, colors, normals, etc.)

Procedure

Select one or several clouds then launch the tool.

Subsampling dialog

Random

In 'random' mode, CloudCompare will simply pick the specified number of points in a random manner.

Subsampling 'Random' parameters

Random (percentage)

In 'random (%)' mode, CloudCompare will simply deduce the number of points and pick them in a random manner.

Subsampling 'Random (%)' parameters

Since version 2.13

Spatial

In 'spatial' mode, the user must set a minimal distance between two points. CloudCompare will then pick points from the original cloud so that no point in the output cloud is closer to another point than the specified value. The bigger this value is, the less point will be kept.

How the algorithm works: points are parsed in a somewhat arbitrary order (spatially organised by the octree). The very first point is flagged as 'to be kept'. Then, for each subsequent point in the cloud, we query its neighbors within the specified radius. If no neighbor point is already flagged as 'to be kept', we also flag this new point as 'to be kept'. In the end, only points flagged as 'to be kept' will be part of the output cloud.

Use active SF (option)

Since version 2.6.1., instead of specifying a single value for the spatial subsampling mode, the user can use the currently active scalar field so as to modulate the sampling distance with the scalar values. The user has to specify the sampling distance corresponding to the minimum and maximum scalar values and CC will linearly interpolate the spatial distance.

For instance, if the cloud is associated to a 'curvature' scalar field, you can tell CloudCompare to sample more points in curvy areas and less points in planar ones:

Original cloud with a scalar field proportional to the local curvature
Subsampling 'Spatial' parameters based on the active scalar field values
Subsampling output

You could do the same with a noise or confidence scalar field, etc.

Octree

The 'octree' mode lets you select a level of subdivision of the octree at which the cloud will be 'simplified'.

In each cell of the octree, the nearest point to the octree cell center is kept.

Notes:

  • the higher the level is, the smaller the cells are (so the more points you'll keep)
  • the maximum octree level is 10 in the 32 bits version of CloudCompare, and 21 in the 64 bits version.
  • the tool differs from the 'Octree > Resample' method. The Resample tool computes the center of gravity of the points falling in each cell (i.e. the created cloud is not a subset of the original cloud)