MeshLib
 
Loading...
Searching...
No Matches
MRICP.h File Reference
#include "MRMeshFwd.h"
#include "MRAffineXf.h"
#include "MRId.h"
#include "MRMeshOrPoints.h"
#include "MRVector3.h"

Go to the source code of this file.

Classes

struct  MRICPPairData
 
struct  MRPointPair
 Stores a pair of points: one samples on the source and the closest to it on the target. More...
 
struct  MRICPProperties
 

Typedefs

typedef MR_EXTERN_C_BEGIN enum MRICPMethod MRICPMethod
 The method how to update transformation from point pairs.
 
typedef enum MRICPMode MRICPMode
 The group of transformations, each with its own degrees of freedom.
 
typedef struct MRICPPairData MRICPPairData
 
typedef struct MRPointPair MRPointPair
 Stores a pair of points: one samples on the source and the closest to it on the target.
 
typedef struct MRIPointPairs MRIPointPairs
 Simple interface for pairs holder.
 
typedef struct MRPointPairs MRPointPairs
 
typedef enum MRICPExitType MRICPExitType
 types of exit conditions in calculation
 
typedef struct MRICPProperties MRICPProperties
 
typedef struct MRICP MRICP
 

Enumerations

enum  MRICPMethod { MRICPMethodCombined = 0 , MRICPMethodPointToPoint = 1 , MRICPMethodPointToPlane = 2 }
 The method how to update transformation from point pairs. More...
 
enum  MRICPMode {
  MRICPModeRigidScale = 0 , MRICPModeAnyRigidXf , MRICPModeOrthogonalAxis , MRICPModeFixedAxis ,
  MRICPModeTranslationOnly
}
 The group of transformations, each with its own degrees of freedom. More...
 
enum  MRICPExitType {
  MRICPExitTypeNotStarted = 0 , MRICPExitTypeNotFoundSolution , MRICPExitTypeMaxIterations , MRICPExitTypeMaxBadIterations ,
  MRICPExitTypeStopMsdReached
}
 types of exit conditions in calculation More...
 

Functions

MRMESHC_API const MRICPPairDatamrIPointPairsGet (const MRIPointPairs *pp, size_t idx)
 
MRMESHC_API MRICPPairDatamrIPointPairsGetRef (MRIPointPairs *pp, size_t idx)
 
MRMESHC_API MRICPProperties mrICPPropertiesNew (void)
 initializes a default instance
 
MRMESHC_API MRICPmrICPNew (const MRMeshOrPointsXf *flt, const MRMeshOrPointsXf *ref, float samplingVoxelSize)
 Constructs ICP framework with automatic points sampling on both objects.
 
MRMESHC_API void mrICPSetParams (MRICP *icp, const MRICPProperties *prop)
 tune algorithm params before run calculateTransformation()
 
MRMESHC_API void mrICPSamplePoints (MRICP *icp, float samplingVoxelSize)
 select pairs with origin samples on both objects
 
MRMESHC_API MRAffineXf3f mrICPAutoSelectFloatXf (MRICP *icp)
 
MRMESHC_API void mrICPUpdatePointPairs (MRICP *icp)
 recompute point pairs after manual change of transformations or parameters
 
MRMESHC_API MRStringmrICPGetStatusInfo (const MRICP *icp)
 returns status info string
 
MRMESHC_API size_t mrICPGetNumSamples (const MRICP *icp)
 computes the number of samples able to form pairs
 
MRMESHC_API size_t mrICPGetNumActivePairs (const MRICP *icp)
 computes the number of active point pairs
 
MRMESHC_API float mrICPGetMeanSqDistToPoint (const MRICP *icp)
 computes root-mean-square deviation between points
 
MRMESHC_API float mrICPGetMeanSqDistToPlane (const MRICP *icp)
 computes root-mean-square deviation from points to target planes
 
MRMESHC_API const MRIPointPairsmrICPGetFlt2RefPairs (const MRICP *icp)
 returns current pairs formed from samples on floating object and projections on reference object
 
MRMESHC_API const MRIPointPairsmrICPGetRef2FltPairs (const MRICP *icp)
 returns current pairs formed from samples on reference object and projections on floating object
 
MRMESHC_API MRAffineXf3f mrICPCalculateTransformation (MRICP *icp)
 
MRMESHC_API void mrICPFree (MRICP *icp)
 deallocates an ICP object
 

Typedef Documentation

◆ MRICP

typedef struct MRICP MRICP

This class allows you to register two object with similar shape using Iterative Closest Points (ICP) point-to-point or point-to-plane algorithms

◆ MRICPExitType

types of exit conditions in calculation

◆ MRICPMethod

The method how to update transformation from point pairs.

◆ MRICPMode

typedef enum MRICPMode MRICPMode

The group of transformations, each with its own degrees of freedom.

◆ MRICPPairData

typedef struct MRICPPairData MRICPPairData

◆ MRICPProperties

typedef struct MRICPProperties MRICPProperties

◆ MRIPointPairs

typedef struct MRIPointPairs MRIPointPairs

Simple interface for pairs holder.

◆ MRPointPair

typedef struct MRPointPair MRPointPair

Stores a pair of points: one samples on the source and the closest to it on the target.

◆ MRPointPairs

typedef struct MRPointPairs MRPointPairs

Enumeration Type Documentation

◆ MRICPExitType

types of exit conditions in calculation

Enumerator
MRICPExitTypeNotStarted 

calculation is not started yet

MRICPExitTypeNotFoundSolution 

solution not found in some iteration

MRICPExitTypeMaxIterations 

iteration limit reached

MRICPExitTypeMaxBadIterations 

limit of non-improvement iterations in a row reached

MRICPExitTypeStopMsdReached 

stop mean square deviation reached

◆ MRICPMethod

The method how to update transformation from point pairs.

Enumerator
MRICPMethodCombined 

PointToPoint for the first 2 iterations, and PointToPlane for the remaining iterations.

MRICPMethodPointToPoint 

select transformation that minimizes mean squared distance between two points in each pair, it is the safest approach but can converge slowly

MRICPMethodPointToPlane 

select transformation that minimizes mean squared distance between a point and a plane via the other point in each pair, converge much faster than PointToPoint in case of many good (with not all points/normals in one plane) pairs

◆ MRICPMode

enum MRICPMode

The group of transformations, each with its own degrees of freedom.

Enumerator
MRICPModeRigidScale 

rigid body transformation with uniform scaling (7 degrees of freedom)

MRICPModeAnyRigidXf 

rigid body transformation (6 degrees of freedom)

MRICPModeOrthogonalAxis 

rigid body transformation with rotation except argument axis (5 degrees of freedom)

MRICPModeFixedAxis 

rigid body transformation with rotation around given axis only (4 degrees of freedom)

MRICPModeTranslationOnly 

only translation (3 degrees of freedom)

Function Documentation

◆ mrICPAutoSelectFloatXf()

MRMESHC_API MRAffineXf3f mrICPAutoSelectFloatXf ( MRICP * icp)

automatically selects initial transformation for the floating object based on covariance matrices of both floating and reference objects; applies the transformation to the floating object and returns it

◆ mrICPCalculateTransformation()

MRMESHC_API MRAffineXf3f mrICPCalculateTransformation ( MRICP * icp)

runs ICP algorithm given input objects, transformations, and parameters;

Returns
adjusted transformation of the floating object to match reference object

◆ mrICPFree()

MRMESHC_API void mrICPFree ( MRICP * icp)

deallocates an ICP object

◆ mrICPGetFlt2RefPairs()

MRMESHC_API const MRIPointPairs * mrICPGetFlt2RefPairs ( const MRICP * icp)

returns current pairs formed from samples on floating object and projections on reference object

◆ mrICPGetMeanSqDistToPlane()

MRMESHC_API float mrICPGetMeanSqDistToPlane ( const MRICP * icp)

computes root-mean-square deviation from points to target planes

◆ mrICPGetMeanSqDistToPoint()

MRMESHC_API float mrICPGetMeanSqDistToPoint ( const MRICP * icp)

computes root-mean-square deviation between points

◆ mrICPGetNumActivePairs()

MRMESHC_API size_t mrICPGetNumActivePairs ( const MRICP * icp)

computes the number of active point pairs

◆ mrICPGetNumSamples()

MRMESHC_API size_t mrICPGetNumSamples ( const MRICP * icp)

computes the number of samples able to form pairs

◆ mrICPGetRef2FltPairs()

MRMESHC_API const MRIPointPairs * mrICPGetRef2FltPairs ( const MRICP * icp)

returns current pairs formed from samples on reference object and projections on floating object

◆ mrICPGetStatusInfo()

MRMESHC_API MRString * mrICPGetStatusInfo ( const MRICP * icp)

returns status info string

◆ mrICPNew()

MRMESHC_API MRICP * mrICPNew ( const MRMeshOrPointsXf * flt,
const MRMeshOrPointsXf * ref,
float samplingVoxelSize )

Constructs ICP framework with automatic points sampling on both objects.

◆ mrICPPropertiesNew()

MRMESHC_API MRICPProperties mrICPPropertiesNew ( void )

initializes a default instance

◆ mrICPSamplePoints()

MRMESHC_API void mrICPSamplePoints ( MRICP * icp,
float samplingVoxelSize )

select pairs with origin samples on both objects

◆ mrICPSetParams()

MRMESHC_API void mrICPSetParams ( MRICP * icp,
const MRICPProperties * prop )

tune algorithm params before run calculateTransformation()

◆ mrICPUpdatePointPairs()

MRMESHC_API void mrICPUpdatePointPairs ( MRICP * icp)

recompute point pairs after manual change of transformations or parameters

◆ mrIPointPairsGet()

MRMESHC_API const MRICPPairData * mrIPointPairsGet ( const MRIPointPairs * pp,
size_t idx )

◆ mrIPointPairsGetRef()

MRMESHC_API MRICPPairData * mrIPointPairsGetRef ( MRIPointPairs * pp,
size_t idx )