ImFusion SDK 4.3
PointCorrespondences Class Reference

#include <ImFusion/Base/PointCorrespondences.h>

Class that handles point correspondences. More...

+ Inheritance diagram for PointCorrespondences:

Detailed Description

Class that handles point correspondences.

Points at corresponding indices on the two PointsOnData instances are considered correspondences. When creating PointCorrespondences(first, second) names of points in first and second are made uniform giving precedence to names in first. Logic for matching points based on their names should be implemented outside of this class. The class supports both full-set and subset-based rigid fitting, allowing users to select specific point correspondences for the transformation calculation. The class supports estimation of a fitting error for any correspondence using complementary correspondences, which can assist with the identification of inconsistent correspondences.

Public Types

enum class  Reduction { Mean , Median , Max , Min }
 Reduction type used during distance evaluation.
 
enum class  FitErrorType { LeaveOneOut = 0 , Hierarchical = 1 }
 

Public Member Functions

 PointCorrespondences (PointsOnData *first, PointsOnData *second)
 Takes two PointsOnData handle the correspondences between them.
 
int size () const
 Returns the smallest number of points out of both PointsOnData.
 
int numberOfPoints () const
 Returns the largest number of points out of both PointsOnData.
 
std::string name (int which) const
 Returns the name of a correspondence.
 
void setName (int which, const std::string &name)
 Sets the name of a correspondence. It sets the name of both points at index which
 
void clear ()
 Removes all the correspondences.
 
void remove (int index)
 Removes a specific correspondence.
 
void remove (int first, int last)
 Removes the correspondences in range [first,last)
 
bool isSelected (int index) const
 Returns whether a point correspondence is selected. Selected correspondences are used during evaluation and fitting. By default all correspondences are selected.
 
void setSelected (int index, bool selected)
 Set whether a point correspondence is selected. Selected correspondences are used during evaluation and fitting.
 
double evaluate (Reduction reduction=Reduction::Mean, const std::vector< double > *weights=nullptr) const
 Computes the distance between pairs of correspondences If an optional weights vector is provided, the individual errors are multiplied with it before reduction.
 
double computePairwiseDistances (Reduction reduction=Reduction::Mean, const std::vector< double > *weights=nullptr) const
 Computes the distance between pairs of correspondences If an optional weights vector is provided, the individual errors are multiplied with it before reduction.
 
mat4 fitRigid (double *errorOut=nullptr, std::optional< std::vector< int > > subsetIndices=std::nullopt) const
 Fit a rigid transformation that aligns the selected points correspondence using Walker method.
 
double calcFitError (int index) const
 Estimate an error (of type m_fitErrorType) for a correspondence (specified by index), based on a fitting procedure involving complementary correspondences Considers the selection.
 
PointsOnDatapointHandler (int which)
 Returns the PointsOnData, index matches container order in construction.
 
const PointsOnDatapointHandler (int which) const
 
void setDefaultNameFormat (std::string format)
 Sets the default name format.
 
void setFitErrorType (FitErrorType type)
 
FitErrorType fitErrorType ()
 
- Public Member Functions inherited from SignalReceiver
 SignalReceiver ()=default
 Default constructor.
 
 SignalReceiver (const SignalReceiver &other)
 Copy constructor, does not copy any existing signal connections from other.
 
SignalReceiveroperator= (SignalReceiver rhs)
 Assignment operator, disconnects all existing connections, does not copy any existing signal connections from rhs.
 
virtual ~SignalReceiver ()
 Virtual destructor disconnects from all connected signals.
 

Public Attributes

Signal signalCorrespondencesChanged
 Signal emitted whenever a correspondence changes. This can be because a correspondence is removed, added or a point is moved.
 

Protected Member Functions

void onPointsAdded (PointsOnData *pod, int first, int last)
 
void onPointsRemoved (int first, int last)
 
void connectSignals ()
 
std::string defaultName (int index) const
 
- Protected Member Functions inherited from SignalReceiver
void disconnectAll ()
 Disconnects all existing connections.
 

Protected Attributes

FitErrorType m_fitErrorType = FitErrorType::LeaveOneOut
 
std::pair< PointsOnData *, PointsOnData * > m_pods
 
bool m_renamingGuard = true
 
std::string m_defaultNameFormat = "Correspondence {}"
 

Member Function Documentation

◆ evaluate()

double evaluate ( Reduction reduction = Reduction::Mean,
const std::vector< double > * weights = nullptr ) const
inline

Computes the distance between pairs of correspondences If an optional weights vector is provided, the individual errors are multiplied with it before reduction.

Deprecated
"evaluate is deprecated, use computePairwiseDistances instead."

◆ fitRigid()

mat4 fitRigid ( double * errorOut = nullptr,
std::optional< std::vector< int > > subsetIndices = std::nullopt ) const

Fit a rigid transformation that aligns the selected points correspondence using Walker method.

Parameters
errorOutIf specified will be filled with the mean error
subsetIndicesIf specified only the points at these indices will be used whether they are selected or not

◆ setDefaultNameFormat()

void setDefaultNameFormat ( std::string format)

Sets the default name format.

The first argument of the format string is the index of the correspondence + 1. For example "Correspondence {}" will generate name "Correspondence 1" for the first correspondence


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