iCub-main
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
iCub::optimization::AffinityWithMatchedPoints Class Reference

A class that deals with the problem of determining the affine transformation matrix A between two sets of matching 3D points employing IpOpt. More...

#include <affinity.h>

+ Inheritance diagram for iCub::optimization::AffinityWithMatchedPoints:

Public Member Functions

 AffinityWithMatchedPoints ()
 Default Constructor. More...
 
virtual void setBounds (const yarp::sig::Matrix &min, const yarp::sig::Matrix &max)
 Allow specifying the minimum and maximum bounds of the elements belonging to the affine transformation. More...
 
virtual bool addPoints (const yarp::sig::Vector &p0, const yarp::sig::Vector &p1)
 Add to the internal database the 3D-point p0 and the 3D-point p1 which is supposed to correspond to A*p0, whose matrix A has to be found. More...
 
virtual size_t getNumPoints () const
 Return the number of 3D-points pairs currently contained into the internal database. More...
 
virtual void getPoints (std::deque< yarp::sig::Vector > &p0, std::deque< yarp::sig::Vector > &p1) const
 Retrieve copies of the database of 3D-points pairs. More...
 
virtual void clearPoints ()
 Clear the internal database of 3D points. More...
 
virtual bool setInitialGuess (const yarp::sig::Matrix &A)
 Allow specifiying the initial guess for the affine transformation matrix we seek for. More...
 
virtual bool setCalibrationOptions (const yarp::os::Property &options)
 Allow setting further options used during calibration. More...
 
virtual bool calibrate (yarp::sig::Matrix &A, double &error)
 Perform optimization to determine the affine matrix A. More...
 
virtual ~AffinityWithMatchedPoints ()
 Destructor. More...
 
- Public Member Functions inherited from iCub::optimization::MatrixTransformationWithMatchedPoints
virtual ~MatrixTransformationWithMatchedPoints ()
 Destructor. More...
 

Protected Member Functions

double evalError (const yarp::sig::Matrix &A)
 

Protected Attributes

yarp::sig::Matrix min
 
yarp::sig::Matrix max
 
yarp::sig::Matrix A0
 
int max_iter
 
double tol
 
std::deque< yarp::sig::Vector > p0
 
std::deque< yarp::sig::Vector > p1
 

Detailed Description

A class that deals with the problem of determining the affine transformation matrix A between two sets of matching 3D points employing IpOpt.

Definition at line 50 of file affinity.h.

Constructor & Destructor Documentation

◆ AffinityWithMatchedPoints()

AffinityWithMatchedPoints::AffinityWithMatchedPoints ( )

Default Constructor.

Definition at line 229 of file affinity.cpp.

◆ ~AffinityWithMatchedPoints()

virtual iCub::optimization::AffinityWithMatchedPoints::~AffinityWithMatchedPoints ( )
inlinevirtual

Destructor.

Definition at line 141 of file affinity.h.

Member Function Documentation

◆ addPoints()

bool AffinityWithMatchedPoints::addPoints ( const yarp::sig::Vector &  p0,
const yarp::sig::Vector &  p1 
)
virtual

Add to the internal database the 3D-point p0 and the 3D-point p1 which is supposed to correspond to A*p0, whose matrix A has to be found.

Parameters
p0the free 3D-point.
p1the 3D-point which corresponds to A*p0.
Returns
true/false on success/fail.

Implements iCub::optimization::MatrixTransformationWithMatchedPoints.

Definition at line 281 of file affinity.cpp.

◆ calibrate()

bool AffinityWithMatchedPoints::calibrate ( yarp::sig::Matrix &  A,
double &  error 
)
virtual

Perform optimization to determine the affine matrix A.

Parameters
Athe final affine matrix that links the two clouds of 3D points.
errorreturns the residual error computed as norm(p1[i]-A*p0[i]) over the whole set of points pairs.
Returns
true/false on success/fail.

Implements iCub::optimization::MatrixTransformationWithMatchedPoints.

Definition at line 341 of file affinity.cpp.

◆ clearPoints()

void AffinityWithMatchedPoints::clearPoints ( )
virtual

Clear the internal database of 3D points.

Implements iCub::optimization::MatrixTransformationWithMatchedPoints.

Definition at line 309 of file affinity.cpp.

◆ evalError()

double AffinityWithMatchedPoints::evalError ( const yarp::sig::Matrix &  A)
protected

Definition at line 265 of file affinity.cpp.

◆ getNumPoints()

virtual size_t iCub::optimization::AffinityWithMatchedPoints::getNumPoints ( ) const
inlinevirtual

Return the number of 3D-points pairs currently contained into the internal database.

Returns
the number of pairs.

Implements iCub::optimization::MatrixTransformationWithMatchedPoints.

Definition at line 95 of file affinity.h.

◆ getPoints()

void AffinityWithMatchedPoints::getPoints ( std::deque< yarp::sig::Vector > &  p0,
std::deque< yarp::sig::Vector > &  p1 
) const
virtual

Retrieve copies of the database of 3D-points pairs.

Parameters
p0the list of free 3D-points.
p1the list of 3D-points which correspond to A*p0.
Note
points are retrived in 4x1 homogeneous format.

Implements iCub::optimization::MatrixTransformationWithMatchedPoints.

Definition at line 300 of file affinity.cpp.

◆ setBounds()

void AffinityWithMatchedPoints::setBounds ( const yarp::sig::Matrix &  min,
const yarp::sig::Matrix &  max 
)
virtual

Allow specifying the minimum and maximum bounds of the elements belonging to the affine transformation.

Parameters
minthe 4x4 Matrix containining the minimum bounds.
maxthe 4x4 Matrix containining the maximum bounds.
Note
the last row is always expected to be (0 0 0 1).

Implements iCub::optimization::MatrixTransformationWithMatchedPoints.

Definition at line 249 of file affinity.cpp.

◆ setCalibrationOptions()

bool AffinityWithMatchedPoints::setCalibrationOptions ( const yarp::os::Property &  options)
virtual

Allow setting further options used during calibration.

Parameters
optionsa Property-like object accounting for calibration options.
Returns
true/false on success/fail.

Reimplemented from iCub::optimization::MatrixTransformationWithMatchedPoints.

Definition at line 328 of file affinity.cpp.

◆ setInitialGuess()

bool AffinityWithMatchedPoints::setInitialGuess ( const yarp::sig::Matrix &  A)
virtual

Allow specifiying the initial guess for the affine transformation matrix we seek for.

Parameters
Athe 4x4 homogeneous matrix used as initial guess.
Returns
true/false on success/fail.

Implements iCub::optimization::MatrixTransformationWithMatchedPoints.

Definition at line 317 of file affinity.cpp.

Member Data Documentation

◆ A0

yarp::sig::Matrix iCub::optimization::AffinityWithMatchedPoints::A0
protected

Definition at line 54 of file affinity.h.

◆ max

yarp::sig::Matrix iCub::optimization::AffinityWithMatchedPoints::max
protected

Definition at line 53 of file affinity.h.

◆ max_iter

int iCub::optimization::AffinityWithMatchedPoints::max_iter
protected

Definition at line 56 of file affinity.h.

◆ min

yarp::sig::Matrix iCub::optimization::AffinityWithMatchedPoints::min
protected

Definition at line 53 of file affinity.h.

◆ p0

std::deque<yarp::sig::Vector> iCub::optimization::AffinityWithMatchedPoints::p0
protected

Definition at line 59 of file affinity.h.

◆ p1

std::deque<yarp::sig::Vector> iCub::optimization::AffinityWithMatchedPoints::p1
protected

Definition at line 60 of file affinity.h.

◆ tol

double iCub::optimization::AffinityWithMatchedPoints::tol
protected

Definition at line 57 of file affinity.h.


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