CCCoreLib 31 May 2022
CloudCompare Core algorithms
Static Public Member Functions | List of all members
CCCoreLib::AutoSegmentationTools Class Reference

Several point cloud auto-segmentation algorithms (Connected Components, Front propagation, etc.) More...

#include <AutoSegmentationTools.h>

Inheritance diagram for CCCoreLib::AutoSegmentationTools:
Inheritance graph
[legend]
Collaboration diagram for CCCoreLib::AutoSegmentationTools:
Collaboration graph
[legend]

Static Public Member Functions

static int labelConnectedComponents (GenericIndexedCloudPersist *theCloud, unsigned char level, bool sixConnexity=false, GenericProgressCallback *progressCb=nullptr, DgmOctree *inputOctree=nullptr)
 Labels connected components from a point cloud. More...
 
static bool extractConnectedComponents (GenericIndexedCloudPersist *theCloud, ReferenceCloudContainer &ccc)
 Extracts connected components from a point cloud. More...
 
static bool frontPropagationBasedSegmentation (GenericIndexedCloudPersist *theCloud, PointCoordinateType radius, ScalarType minSeedDist, unsigned char octreeLevel, ReferenceCloudContainer &theSegmentedLists, GenericProgressCallback *progressCb=nullptr, DgmOctree *inputOctree=nullptr, bool applyGaussianFilter=false, float alpha=2.0f)
 Segment a point cloud by propagating fronts constrained by values of the point cloud associated scalar field. More...
 

Detailed Description

Several point cloud auto-segmentation algorithms (Connected Components, Front propagation, etc.)

Member Function Documentation

◆ extractConnectedComponents()

bool AutoSegmentationTools::extractConnectedComponents ( GenericIndexedCloudPersist theCloud,
ReferenceCloudContainer &  ccc 
)
static

Extracts connected components from a point cloud.

This method shloud only be called after the connected components have been labeled (see AutoSegmentationTools::labelConnectedComponents). This implementation of the algorithm assumes that the CCs labels are stored for each point in the associated scalar field. Warning: be sure to set the labels S.F. as OUTPUT (reading)

Parameters
theCloudthe point cloud to segment
cccthe extracted connected compenents (as a list of subsets of points)
Returns
success

◆ frontPropagationBasedSegmentation()

bool AutoSegmentationTools::frontPropagationBasedSegmentation ( GenericIndexedCloudPersist theCloud,
PointCoordinateType  radius,
ScalarType  minSeedDist,
unsigned char  octreeLevel,
ReferenceCloudContainer &  theSegmentedLists,
GenericProgressCallback progressCb = nullptr,
DgmOctree inputOctree = nullptr,
bool  applyGaussianFilter = false,
float  alpha = 2.0f 
)
static

Segment a point cloud by propagating fronts constrained by values of the point cloud associated scalar field.

The algorithm is described in Daniel Girardeau-Montaut's PhD manuscript (Chapter 3, section 3.3). It consists mainly in propagating a front on the surface implicitly represented by the point cloud and making this propagation dependent on the scalar values associated to each point (such as the distance information computed between the point cloud and another entity). The propgation is realized with the Fast Marching Algorithm applied on a gridded structure (the octree in this case). Warning: be sure to activate an OUTPUT scalar field on the input cloud

Parameters
theCloudthe point cloud to segment
minSeedDistthe minimum value associated to the point where to start the propagation from ("security" value)
radiusspherical neighborhood size (or 0 for automatic size)
octreeLevellevel of subdivision where to apply the gridding (the greater it is, the smaller and numerous the segmented parts will be)
theSegmentedListsthe segmented parts (as a list of subsets of points)
applyGaussianFilterto specify if a gaussian filter should be applied after computing the scalar field gradient (to smooth the results)
progressCbthe client application can get some notification of the process progress through this callback mechanism (see GenericProgressCallback)
inputOctreethe cloud octree if it has already be computed
alphathe gaussian filter kernel size (needed only if a gaussian filtering pass is required)
Returns
success

◆ labelConnectedComponents()

int AutoSegmentationTools::labelConnectedComponents ( GenericIndexedCloudPersist theCloud,
unsigned char  level,
bool  sixConnexity = false,
GenericProgressCallback progressCb = nullptr,
DgmOctree inputOctree = nullptr 
)
static

Labels connected components from a point cloud.

The algorithm is described in Daniel Girardeau-Montaut's PhD manuscript (Chapter 3, section 3.2.4). The main parameter is the maximal distance between two points in order to consider them as belonging to the same connected component. Actually, this parameter is not expressed as is, but as the length of a cell of the octree for a given level of subdivision (this leeds to a great enhancement of the process speed). If the level is "n", then the cell size will be equal to the maximum length of the bounding box of the point cloud divided by 2^n. The greater the level "n" is, the smaller the cell size will be, and therefore the process will produce more connected components.To label the CCs, this implementation of the algorithm use the distance field (via Generic3dPoint::setDist). So be sure to store the original distance field (or to deviate the setDist process) if you don't want it to be replaced.

Parameters
theCloudthe point cloud to label
levelthe level of subdivision of the octree (between 1 and MAX_OCTREE_LEVEL)
sixConnexityindicates if the CC's 3D connexity should be 6 (26 otherwise)
progressCbthe client application can get some notification of the process progress through this callback mechanism (see GenericProgressCallback)
inputOctreethe cloud octree if it has already been computed
Returns
the number of components (>= 0) or an error code (< 0 - see DgmOctree::extractCCs)

The documentation for this class was generated from the following files: