![]() |
ImFusion SDK 4.3
|
#include <ImFusion/Vision/MeshAlignmentAlgorithm.h>
Algorithm for aligning meshes and point clouds. More...
Inheritance diagram for MeshAlignmentAlgorithm:Algorithm for aligning meshes and point clouds.
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. | |
| PointCloud * | inputPointCloud () 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. | |
| Progress * | progress () 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 FactoryInfo & | factoryInfo () 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 | |
| Configurable & | operator= (const Configurable &) |
| Configurable & | operator= (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. | |
| Progress * | m_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< Action > | m_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< Param > | m_params |
| List of all registered Parameter and SubProperty instances. | |
|
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. |
|
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. |
|
overridevirtual |
Runs the mesh alignment algorithm.
Implements Algorithm.
|
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
|
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
|
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.
Reimplemented from Configurable.
|
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.
Reimplemented from Configurable.