ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
cloudViewer::FPCSRegistrationTools Class Reference

#include <RegistrationTools.h>

Inheritance diagram for cloudViewer::FPCSRegistrationTools:
Collaboration diagram for cloudViewer::FPCSRegistrationTools:

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 cloudViewer::RegistrationTools
static void FilterTransformation (const ScaledTransformation &inTrans, int transformationFilters, const CCVector3 &toBeAlignedGravityCenter, const CCVector3 &referenceGravityCenter, ScaledTransformation &outTrans)
 

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 cloudViewer::RegistrationTools
static bool RegistrationProcedure (GenericCloud *P, GenericCloud *X, ScaledTransformation &trans, bool adjustScale=false, ScalarField *coupleWeights=nullptr, PointCoordinateType aPrioriScale=1.0f, CCVector3 *Gp=nullptr, CCVector3 *Gx=nullptr)
 ICP Registration procedure with optional scale estimation. More...
 

Additional Inherited Members

- Public Types inherited from cloudViewer::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. More...
 
using ScaledTransformation = PointProjectionTools::Transformation
 Shortcut to PointProjectionTools::ScaledTransformation. More...
 

Detailed Description

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

Definition at line 246 of file RegistrationTools.h.

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

Definition at line 1284 of file RegistrationTools.cpp.

References count, cloudViewer::KDTree::findPointBelowDistance(), cloudViewer::GenericIndexedCloud::getPoint(), cloudViewer::PointProjectionTools::Transformation::R, cloudViewer::GenericCloud::size(), cloudViewer::PointProjectionTools::Transformation::T, and Tuple3Tpl< Type >::u.

Referenced by RegisterClouds().

◆ 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

Definition at line 1633 of file RegistrationTools.cpp.

References cloudViewer::PointCloudTpl< T >::addPoint(), cloudViewer::PointProjectionTools::applyTransformation(), copy, cloudViewer::FPCSRegistrationTools::Base::getIndex(), cloudViewer::GenericIndexedCloud::getPoint(), cloudViewer::RegistrationTools::RegistrationProcedure(), cloudViewer::PointCloudTpl< T >::reserve(), cloudViewer::PointCloudTpl< T >::reset(), and cloudViewer::PointCloud::resize().

Referenced by RegisterClouds().

◆ 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

Definition at line 1306 of file RegistrationTools.cpp.

References abs(), Vector3Tpl< Type >::dot(), cloudViewer::GenericIndexedCloud::getPoint(), cloudViewer::FPCSRegistrationTools::Base::init(), Vector3Tpl< Type >::norm2(), normal, cloudViewer::GenericCloud::size(), size, Tuple3Tpl< Type >::x, Tuple3Tpl< Type >::y, and Tuple3Tpl< Type >::z.

Referenced by RegisterClouds().

◆ FindCongruentBases()

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

◆ 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

Definition at line 1595 of file RegistrationTools.cpp.

References abs(), Vector3Tpl< Type >::dot(), Tuple3Tpl< Type >::x, Tuple3Tpl< Type >::y, and Tuple3Tpl< Type >::z.

Referenced by FindCongruentBases().

◆ 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.

Definition at line 1139 of file RegistrationTools.cpp.

References cloudViewer::KDTree::buildFromCloud(), ComputeRegistrationScore(), count, FilterCandidates(), FindBase(), FindCongruentBases(), cloudViewer::GenericCloud::getBoundingBox(), cloudViewer::FPCSRegistrationTools::Base::getIndex(), cloudViewer::GenericIndexedCloud::getPoint(), cloudViewer::SquareMatrixTpl< Scalar >::invalidate(), cloudViewer::GenericProgressCallback::isCancelRequested(), cloudViewer::SquareMatrixTpl< Scalar >::isValid(), Vector3Tpl< Type >::norm(), cloudViewer::PointProjectionTools::Transformation::R, result, cloudViewer::GenericProgressCallback::setInfo(), cloudViewer::GenericCloud::size(), cloudViewer::GenericProgressCallback::stop(), cloudViewer::PointProjectionTools::Transformation::T, cloudViewer::GenericProgressCallback::textCanBeEdited(), and cloudViewer::GenericProgressCallback::update().

Referenced by define_RegistrationTools().


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