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

Four Points Congruent Sets (4PCS) registration algorithm (Dror Aiger, Niloy J. Mitra, Daniel Cohen-Or) More...

#include <RegistrationTools.h>

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

Classes

struct  Base
 FCPS base. More...
 

Static Public Member Functions

static bool RegisterClouds (GenericIndexedCloud *modelCloud, GenericIndexedCloud *dataCloud, ScaledTransformation &transform, ScalarType delta, ScalarType beta, PointCoordinateType overlap, unsigned nbBases, unsigned nbTries, GenericProgressCallback *progressCb=nullptr, unsigned nbMaxCandidates=0)
 Registers two point clouds. More...
 
- Static Public Member Functions inherited from CCCoreLib::RegistrationTools
static void FilterTransformation (const ScaledTransformation &inTrans, int transformationFilters, ScaledTransformation &outTrans)
 'Filters' a transformation by constraining it along certain rotation axes and translation directions More...
 

Static Protected Member Functions

static bool FindBase (GenericIndexedCloud *cloud, PointCoordinateType overlap, unsigned nbTries, Base &base)
 Randomly finds a 4 points base in a cloud. More...
 
static int FindCongruentBases (KDTree *tree, ScalarType delta, const CCVector3 *base[4], std::vector< Base > &results)
 
static unsigned ComputeRegistrationScore (KDTree *modelTree, GenericIndexedCloud *dataCloud, ScalarType delta, const ScaledTransformation &dataToModel)
 Registration score computation function. More...
 
static bool LinesIntersections (const CCVector3 &p0, const CCVector3 &p1, const CCVector3 &p2, const CCVector3 &p3, CCVector3 &inter, PointCoordinateType &lambda, PointCoordinateType &mu)
 Find the 3D pseudo intersection between two lines. More...
 
static bool FilterCandidates (GenericIndexedCloud *modelCloud, GenericIndexedCloud *dataCloud, Base &reference, std::vector< Base > &candidates, unsigned nbMaxCandidates, std::vector< ScaledTransformation > &transforms)
 
- Static Protected Member Functions inherited from CCCoreLib::RegistrationTools
static bool RegistrationProcedure (GenericCloud *P, GenericCloud *X, ScaledTransformation &trans, bool adjustScale=false, ScalarField *coupleWeights=nullptr, PointCoordinateType aPrioriScale=1.0f)
 ICP Registration procedure with optional scale estimation. More...
 

Additional Inherited Members

- Public Types inherited from CCCoreLib::RegistrationTools
enum  TRANSFORMATION_FILTERS {
  SKIP_NONE = 0 , SKIP_RXY = 1 , SKIP_RYZ = 2 , SKIP_RXZ = 4 ,
  SKIP_ROTATION = 7 , SKIP_TX = 8 , SKIP_TY = 16 , SKIP_TZ = 32 ,
  SKIP_TRANSLATION = 56
}
 Transformation constraints.
 
using ScaledTransformation = PointProjectionTools::Transformation
 Shortcut to PointProjectionTools::ScaledTransformation.
 

Detailed Description

Four Points Congruent Sets (4PCS) registration algorithm (Dror Aiger, Niloy J. Mitra, Daniel Cohen-Or)

Member Function Documentation

◆ ComputeRegistrationScore()

unsigned FPCSRegistrationTools::ComputeRegistrationScore ( KDTree modelTree,
GenericIndexedCloud dataCloud,
ScalarType  delta,
const ScaledTransformation dataToModel 
)
staticprotected

Registration score computation function.

!

Parameters
modelTreeKD-tree containing the model point cloud
dataClouddata point cloud
dataToModeltransformation that, applied to data points, register model and data clouds
deltatolerance above which data points are not counted (if a point is less than delta-apart from the model cloud, then it is counted)
Returns
the number of data points which are distance-apart from the model cloud

◆ FilterCandidates()

bool FPCSRegistrationTools::FilterCandidates ( GenericIndexedCloud modelCloud,
GenericIndexedCloud dataCloud,
Base reference,
std::vector< Base > &  candidates,
unsigned  nbMaxCandidates,
std::vector< ScaledTransformation > &  transforms 
)
staticprotected

!function to keep only the N best candidates bases (by comparison with the reference base invariants) Let B1 and B2 be 2 candidates, R be the reference, B1 and B2 aligned with R. B1 is better than B2 if the distance between B1 and R points is smaller than distance between B2 and R points. This function also computes and store the rigid transforms that align candidates with reference base

Parameters
modelCloudthe model point cloud to work on
dataCloudthe data point cloud to work on
referencereference base
candidatesarray of candidates bases. At the end of the function, this array contains the nbMaxBases best candidates only
nbMaxCandidatesmaximal number of candidates allowed (if 0, number of candidates is not bounded)
transformsarray of rigid transforms that align candidates bases with the reference base
Returns
false if something went wrong

◆ FindBase()

bool FPCSRegistrationTools::FindBase ( GenericIndexedCloud cloud,
PointCoordinateType  overlap,
unsigned  nbTries,
Base base 
)
staticprotected

Randomly finds a 4 points base in a cloud.

Parameters
cloudthe point cloud in which we want to find a base
overlapestimation of the overlap rate
nbTriesthe maximum number of tries to find a base
basethe resulting base
Returns
false: failure ; true: success

◆ FindCongruentBases()

int FPCSRegistrationTools::FindCongruentBases ( KDTree tree,
ScalarType  delta,
const CCVector3 base[4],
std::vector< Base > &  results 
)
staticprotected

Find bases which are congruent to a specified 4 points base

Parameters
treethe KD-tree build from data cloud
deltaused for the tolerance when searching for congruent bases
basethe reference base made of 4 points
resultsthe resulting bases
Returns
the number of bases found (number of element in the results array) or -1 is a problem occurred

◆ LinesIntersections()

bool FPCSRegistrationTools::LinesIntersections ( const CCVector3 p0,
const CCVector3 p1,
const CCVector3 p2,
const CCVector3 p3,
CCVector3 inter,
PointCoordinateType &  lambda,
PointCoordinateType &  mu 
)
staticprotected

Find the 3D pseudo intersection between two lines.

This function finds the 3D point which is the nearest from the both lines (when this point is unique, i.e. when the lines are not parallel)

Parameters
p0first of the two distinct points defining the first line (lying on the line)
p1second of the two distinct points defining the first line (lying on the line)
p2first of the two distinct points defining the second line
p3first of the two distinct points defining the second line
inter[out] is the computed intersection (function output)
lambda[out] coeff such that p0+lambda(p1-p0) is the point of [p0, p1] which is the nearest from [p2, p3]
mu[out] coeff such that p2+mu(p3-p2) is the point of [p2, p3] which is the nearest from [p0, p1]
Returns
false: no intersection was found (lines may be parallel); true: inter is the pseudo intersection

◆ RegisterClouds()

bool FPCSRegistrationTools::RegisterClouds ( GenericIndexedCloud modelCloud,
GenericIndexedCloud dataCloud,
ScaledTransformation transform,
ScalarType  delta,
ScalarType  beta,
PointCoordinateType  overlap,
unsigned  nbBases,
unsigned  nbTries,
GenericProgressCallback progressCb = nullptr,
unsigned  nbMaxCandidates = 0 
)
static

Registers two point clouds.

Implements the 4 Points Congruent Sets Algorithm (Dror Aiger, Niloy J. Mitra, Daniel Cohen-Or

Parameters
modelCloudthe reference cloud (won't move)
dataCloudthe cloud to register (will move)
transformthe resulting transformation (output)
deltamaximal distance to the reference cloud for the data points to be considered as registered
betais used for bases selection (error tolerance)
overlapestimation of the two clouds overlap rate
nbBasesnumber of iteration for the algorithm
nbTriesnumber of tries to find a base in the reference cloud
progressCbthe client application can get some notification of the process progress through this callback mechanism (see GenericProgressCallback)
nbMaxCandidatesif>0, maximal number of candidate bases allowed for each step. Otherwise the number of candidates is not bounded
Returns
false: failure ; true: success.

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