ImFusion SDK 4.3
MeshAlignmentAlgorithm Class Reference

#include <ImFusion/Vision/MeshAlignmentAlgorithm.h>

Algorithm for aligning meshes and point clouds. More...

+ Inheritance diagram for MeshAlignmentAlgorithm:

Detailed Description

Algorithm for aligning meshes and point clouds.

Public Types

enum class  ICPAlgorithm {
  NearestNeighborPointToPlaneICP , ProjectivePointToPlaneICP , PointToPointICP_PCL , PointToPlaneICP_PCL ,
  GICP_PCL , GICP_PCL_Color , PointToPointICP_Open3D , PointToPlaneICP_Open3D ,
  ColoredICP_Open3D , GlobalICP , RANSACGlobalRegistration_Open3D , FastGlobalRegistration_Open3D ,
  ManualCorrespondences
}
 Enumeration of different ICP algorithms that can be used for mesh alignment. More...
 
enum class  GlobalICPAlgorithm {
  SequentialProjectiveICPWithErrorCorrection , SequentialNearestNeighborICPWithErrorCorrection , FullProjectiveICPWithErrorCorrection , FullProjectiveICPWithoutErrorCorrection ,
  IterativeGlobalICP
}
 Enumeration of different global ICP algorithms that can be used for mesh alignment. Only relevant when ICPAlgorithm is GlobalICP. More...
 
- Public Types inherited from Algorithm
enum  Status {
  Unknown = -1 , Success = 0 , Error = 1 , InvalidInput ,
  IncompleteInput , OutOfMemoryHost , OutOfMemoryGPU , UnsupportedGPU ,
  UnknownAction , AbortedByUser , User = 1000
}
 Status codes. More...
 

Public Member Functions

 MeshAlignmentAlgorithm (const DataList &meshesAndPointClouds)
 Constructor that takes a list of meshes and point clouds to be aligned. The first mesh or point cloud in the list is considered the input point cloud, and the rest are considered target point clouds to which the input point cloud will be aligned.
 
PointCloudinputPointCloud () const
 Returns the input point cloud that is being aligned.
 
std::vector< PointCloud * > targetPointClouds () const
 Returns the target point clouds to which the input point cloud is aligned.
 
void compute () override
 Runs the mesh alignment algorithm.
 
double computeRMS (int *matchedPoints=nullptr, std::vector< std::vector< int > > *matches=nullptr, bool weighted=true) const
 Works only when there are more than 2 input pointclouds/meshes or when the ICPAlgorithm is GlobalICP, ProjectivePointToPlaneICP or NearestNeighborPointToPlaneICP.
 
void setUseGPU (bool use)
 Set whether to use GPU for alignment in the projective ICP algorithms.
 
bool useGPU () const
 Get whether to use GPU for alignment in the projective ICP algorithms.
 
void setMaxICPIterations (int count)
 Set maximum number of iterations for ICP.
 
int maxICPIterations () const
 Get maximum number of iterations for ICP.
 
void setICPAlgorithm (ICPAlgorithm mode)
 Set the ICP algorithm to use for alignment.
 
ICPAlgorithm icpAlgorithm () const
 Get the ICP algorithm that is used for alignment.
 
void setGlobalICPAlgorithm (GlobalICPAlgorithm mode)
 Set the global ICP algorithm to use for alignment. This has an effect only when ICPAlgorithm is GlobalICP.
 
GlobalICPAlgorithm globalICPAlgorithm () const
 Get the global ICP algorithm that is used for alignment. This has an effect only when ICPAlgorithm is GlobalICP.
 
void setGlobalICPIterations (int iter)
 Set the number of iterations for global ICP.
 
int globalICPIterations () const
 Get the number of iterations for global ICP.
 
void setGlobalICPMinOverlap (double overlap)
 Set minimum overlap ratio for global ICP.
 
double globalICPMinOverlap () const
 Get minimum overlap ratio for global ICP.
 
void setUseReciprocalCorrespondences (bool use)
 Set whether to use reciprocal correspondences for alignment. A reciprocal correspondence is a pair of points where each point is the nearest neighbor of the other.
 
bool useReciprocalCorrespondences () const
 Get whether to use reciprocal correspondences for alignment.
 
void setMaxCorrespondenceDistance (double maxDist)
 Set maximum distance between corresponding points.
 
double maxCorrespondenceDistance () const
 Get maximum distance between corresponding points.
 
void setMaxCorrespondenceAngle (double angle)
 Set maximum angle between corresponding point normals in degrees.
 
double maxCorrespondenceAngle () const
 Get maximum angle between corresponding point normals in degrees.
 
void setAbortParameterTolerance (double tol)
 Set the tolerance for aborting the ICP optimization based on parameter changes.
 
double abortParameterTolerance () const
 Get the tolerance for aborting the ICP optimization based on parameter changes.
 
void setOverlapRatio (double ratio)
 Set the overlap ratio between point clouds.
 
double overlapRatio () const
 Get the overlap ratio between point clouds.
 
void setVoxelSize (double v)
 Set the voxel size for downsampling point clouds before alignment.
 
double voxelSize () const
 Get the voxel size for downsampling point clouds before alignment.
 
void setComputeGlobalAlignmentError (bool computeError)
 Computes and prints global alignment error before and after optimization.
 
bool computeGlobalAlignmentError () const
 Get whether to compute global alignment error before and after optimization.
 
void setAlignAcrossLoop (bool align)
 Set whether to align the last to the first point cloud. This is relevant only when ICPAlgorithm is GlobalICP. Any residual alignment error will be distributed across all point clouds.
 
bool alignAcrossLoop () const
 Get whether to align the last to the first point cloud.
 
void setPointCorrespondences (const std::vector< std::vector< vec3 > > &correspondences)
 Set corresponding points for each point cloud. In the mode "ManualCorrespondences" point clouds will be aligned based on alignment of these corresponding points.
 
std::vector< std::pair< double, double > > rmsErrorsBeforeAndAfterAlignment () const
 Get RMS errors before and after alignment for each pointcloud This gets filled only when ICPAlgorithm is GlobalICP and GlobalICPAlgorithm is IterativeGlobalICP, FullProjectiveICPWithErrorCorrection or FullProjectiveICPWithoutErrorCorrection; or when ICPAlgorithm is ProjectivePointToPlaneICP, NearestNeighborPointToPlaneICP.
 
void configure (const Properties *p) override
 Configure this object instance by de-serializing the given Properties.
 
void configuration (Properties *p) const override
 Serialize the current object configuration into the given Properties object.
 
- Public Member Functions inherited from Algorithm
 Algorithm ()
 Default constructor will registers a single "compute" action that calls compute() and returns status().
 
virtual OwningDataList takeOutput ()
 Return any new Data that was created by the Algorithm during the last call to compute().
 
virtual void setProgress (Progress *progress)
 Sets a Progress interface the algorithm can use to notify observers about its computing progress.
 
Progressprogress () const
 Returns the progress interface if set.
 
virtual int status () const
 Indicates the status of the last call to compute().
 
virtual bool survivesDataDeletion (const Data *) const
 Indicates whether the algorithm can handle (partial) deletion of the specified data, by default this checks whether the data is in the input list.
 
const FactoryInfofactoryInfo () const
 Returns the record describing how this Algorithm was instantiated by the AlgorithmFactory.
 
void setFactoryInfo (const FactoryInfo &value)
 Sets the record describing how this Algorithm was instantiated by the AlgorithmFactory.
 
Status runAction (const std::string &id)
 Run the action with name id if it exists.
 
const std::vector< Action > & actions ()
 Get a mapping from Action id to Action as registered in this algorithm.
 
- Public Member Functions inherited from Configurable
virtual void configureDefaults ()
 Retrieve the properties of this object, replaces values with their defaults and sets it again.
 
void registerParameter (ParameterBase *param)
 Register the given Parameter or SubProperty, so that it will be configured during configure()/configuration().
 
void unregisterParameter (const ParameterBase *param)
 Remove the given Parameter or SubProperty from the list of registered parameters.
 
 Configurable (const Configurable &rhs)
 
 Configurable (Configurable &&rhs) noexcept
 
Configurableoperator= (const Configurable &)
 
Configurableoperator= (Configurable &&) noexcept
 

Static Public Member Functions

static bool createCompatible (const DataList &data, Algorithm **a=0)
 
static void inputDataInfo (bool &hasNormals, bool &hasTargetNormals, bool &hasK, bool &hasColors, const DataList &dl, bool *hasWeights=nullptr)
 Returns whether the input data has normals, target normals, camera intrinsics, and colors.
 
- Static Public Member Functions inherited from Algorithm
static bool createCompatible (const DataList &data, Algorithm **a=nullptr)
 Factory function to check algorithm compatibility with input data and optionally instantiate it.
 

Additional Inherited Members

- Public Attributes inherited from Algorithm
Signal signalOutputChanged
 Signal should be emitted by Algorithms when their output/result has changed.
 
Signal signalParametersChanged
 Signal should be emitted by Algorithms when their parameter configuration has changed.
 
- Public Attributes inherited from Configurable
Signal signalParametersChanged
 Emitted whenever one of the registered Parameters' or SubPropertys' signalValueChanged signal was emitted.
 
- Protected Member Functions inherited from Algorithm
void loadDefaults ()
 
void registerAction (const std::string &id, const std::string &guiName, const std::function< Algorithm::Status(void)> &action)
 Register an action to be run via runAction.
 
template<typename D>
void registerAction (const std::string &id, const std::string &guiName, Algorithm::Status(D::*action)(void))
 Template version of runAction that can be used with a pointer to a member function.
 
void registerAction (const Action &action)
 Register an action.
 
- Protected Attributes inherited from Algorithm
std::string m_name
 Algorithm name.
 
Progressm_progress = nullptr
 Non-owing pointer to a progress interface. May be a nullptr.
 
FactoryInfo m_factoryInfo = {}
 Record describing how this algorithm was instantiated by the AlgorithmFactory.
 
int m_status = Status::Unknown
 Algorithm status after last call to compute()
 
std::vector< Actionm_actions
 Map of key given by the id of the action, of the available actions of this algorithm.
 
- Protected Attributes inherited from Configurable
std::vector< Paramm_params
 List of all registered Parameter and SubProperty instances.
 

Member Enumeration Documentation

◆ ICPAlgorithm

enum class ICPAlgorithm
strong

Enumeration of different ICP algorithms that can be used for mesh alignment.

Enumerator
NearestNeighborPointToPlaneICP 

Point-to-point ICP with nearest-neighbor matching strategy. Requires normals from target.

ProjectivePointToPlaneICP 

Point-to-plane ICP with projective matching strategy. Requires dense calibrated point clouds and normals from target.

PointToPointICP_PCL 

PCL implementation of point-to-point ICP. Doesn't require normals.

PointToPlaneICP_PCL 

PCL implementation of point-to-plane ICP. Requires normals from target.

GICP_PCL 

PCL implementation of Generalized ICP. Doesn't require normals.

GICP_PCL_Color 

PCL implementation of Generalized ICP with color information. Doesn't require normals.

PointToPointICP_Open3D 

Open3D implementation of point-to-point ICP. Doesn't require normals.

PointToPlaneICP_Open3D 

Open3D implementation of point-to-plane ICP. Requires normals from target.

ColoredICP_Open3D 

Open3D implementation of colored ICP. Doesn't require normals.

GlobalICP 

Global ICP algorithm that aligns multiple point clouds. Requires normals from all point clouds.

RANSACGlobalRegistration_Open3D 

Open3D implementation of RANSAC-based global registration. Requires normals from all point clouds.

FastGlobalRegistration_Open3D 

Open3D implementation of fast global registration. Requires normals from all point clouds.

ManualCorrespondences 

Aligns point clouds based on provided correspondences.

◆ GlobalICPAlgorithm

enum class GlobalICPAlgorithm
strong

Enumeration of different global ICP algorithms that can be used for mesh alignment. Only relevant when ICPAlgorithm is GlobalICP.

Enumerator
SequentialProjectiveICPWithErrorCorrection 

Sequential projective ICP with error correction. Requires dense calibrated point clouds and normals from all point clouds.

SequentialNearestNeighborICPWithErrorCorrection 

Sequential nearest neighbor ICP with error correction.

FullProjectiveICPWithErrorCorrection 

Full projective ICP with error correction. Requires dense calibrated point clouds and normals from all point clouds.

FullProjectiveICPWithoutErrorCorrection 

Full projective ICP without error correction. Requires dense calibrated point clouds and normals from all point clouds.

IterativeGlobalICP 

Iterative global ICP algorithm. Requires dense calibrated point clouds and normals from all point clouds.

Member Function Documentation

◆ compute()

void compute ( )
overridevirtual

Runs the mesh alignment algorithm.

Implements Algorithm.

◆ setComputeGlobalAlignmentError()

void setComputeGlobalAlignmentError ( bool computeError)
inline

Computes and prints global alignment error before and after optimization.

Disable for performance critical code. This has an effect only when ICPAlgorithm is GlobalICP or when the number of input pointclouds/meshes is > 2, and all the data has normals

◆ rmsErrorsBeforeAndAfterAlignment()

std::vector< std::pair< double, double > > rmsErrorsBeforeAndAfterAlignment ( ) const
inline

Get RMS errors before and after alignment for each pointcloud This gets filled only when ICPAlgorithm is GlobalICP and GlobalICPAlgorithm is IterativeGlobalICP, FullProjectiveICPWithErrorCorrection or FullProjectiveICPWithoutErrorCorrection; or when ICPAlgorithm is ProjectivePointToPlaneICP, NearestNeighborPointToPlaneICP.

For ICPAlgorithms PointToPointICP_PCL, PointToPlaneICP_PCL, GICP_PCL, GICP_PCL_Color, PointToPointICP_Open3D, PointToPlaneICP_Open3D, ColoredICP_Open3D, RANSACGlobalRegistration_Open3D and FastGlobalRegistration_Open3D only the RMS after the alignment gets filled, the RMS before the alignment is set to -1

◆ configure()

void configure ( const Properties * p)
overridevirtual

Configure this object instance by de-serializing the given Properties.

The default implementation will do so automatically for all registered Parameter and SubProperty instances.

See also
configuration() for the inverse functionality

Reimplemented from Configurable.

◆ configuration()

void configuration ( Properties * p) const
overridevirtual

Serialize the current object configuration into the given Properties object.

The default implementation will do so automatically for all registered Parameter and SubProperty instances.

See also
configure() for the inverse functionality

Reimplemented from Configurable.


The documentation for this class was generated from the following file:
Search Tab / S to search, Esc to close