Developer Documentation
Centre for Vision, Speech & Signal Processing
USER IN NAMESPACE AMMA TREE ROOT AMMA SEARCH AMMA HOME
 

  PUBLIC
NRegisC::~NRegisC(void)
NRegisC::NRegisC(CorrSetC,SArray1dC,int,double,int,int)
NRegisC::SetExpectedRTs(SArray1dC)
NRegisC::InitView(int,RigidTransC,Vector3dC,double,double)
NRegisC::InitPairwise(void)
NRegisC::Solve(void)
NRegisC::Answer(int)
NRegisC::FinalCost(void)
NRegisC::FinalCost(SArray1dC)
NRegisC::ComputeCM(void)
NRegisC::InitCorres(CorSpecT)
NRegisC::ShortCost(SArray1dC)
NRegisC::Cost(SArray1dC)
NRegisC::Graph(double,double)
NRegisC::ComputeForces(CorresT &,ViewT,ViewT)
NRegisC::QC_Step(double,double &,double &)
NRegisC::Euler(double,SArray1dC)
NRegisC
 
N-Point Set Registration.
 
include "amma/NRegis.hh"
User Level:Default
Library:Regis
Example: testcom.cc
Section: 3D Surface.Registration
In Scope:std

Comments:

Suppose we have nviews rigid objects, and ncorres set of pairwise point correspondences. Suppose we know roughly the rigid body transforms needed to align them. This routine aligns them precisely.

Specifically it minimizes the cost \sum_mu \sum_i w_i (y^a_i-y^b_i)^2

The initial data is supplied with initial guesses The results are the transforms necessary to move the raw data into alignment but keeping the rt[0] null. [ So the answer is the same no matter what the guess. ]

If there are only two objects, the problem can be solved exactly, see RegisC, based on Kanatani.

The problem is basically solved by gradient descent on the cost function. It turns out that the gradient descent depends on the origin of the coordinate system. We allow this to be specified by the quantity center of mass. For a fast stable solution the center of mass should be near the center of the object.

Notes on numerical accuracy
---------------------------

Because of how it is computed the ShortCost becomes inaccurate at about 1e-7 relative error. The LongCost does not but takes order N time to compute.

Quality Controlled Euler stepping
---------------------------------

In this problem we compute maxdiff. This is the error between 2 steps and one divided by ascale and dscale. We require it to be less than 20% - [the variable maxerror].

In the case that the stepsize is extremely small the denominator is set to 1e-20 the meaningful scale. This means that the step size cannot grow arbitrarily large.

The output error is the actual step divided by a meaningful scale such as boxdiag or 2PI.

Tracing
-------

The QC step returns outerror=MAX(dscale/boxdiag, ascale/2/AMMA_PI)

dscale and ascale are the distance and angle moved in the one big step but may not fall below dscale=1e-20 * boxdiag, ascale=1e-20 * 2*AMMA_PI;

Good Convergence
----------------

... is not guarateed. However the following steps will aid performance:

       - A center of mass in the middle of the view
       - Set mass=1
       - Set moment=mass * R^2                                          
Additional Notes
----------------

The constructor allows guesses to be passed which will then be used to initialise the rigid transforms associated with each view.

The expected rigid transforms can be passed via the function SetExpectedRTs, which is only used for the calculation of delta theta.

Variables:
const double mach_precision;

const double mach_precision = 5e-14;
The smallest relative error attainable

int nviews;
The total number of views and correspondences

int ncorres;
The total number of views and correspondences

const int minIterationsM;
Termination criteria is not used until the minimum number of iterations has been done.

const int maxIterationsM;
Maximum number of iterations allowed.

SArray1dC q;
All the info for a set of views, called q because it is the dynamic variable

SArray1dC c;
All the info for a set of correspondences used during computation

CorrSetC corrsetM;
Correspondence sets, with member functions which for example can apply an RT per view

SArray1dC cspecs;
All the info for a set of correspondences as supplied by the user Handle to correspondence sets, ie cspecs = corrsetM.csetsM;

Vector3dC boxmin;
A box containing all the data supplied to the algorithm

Vector3dC boxmax;
A box containing all the data supplied to the algorithm

double boxdiag;
The diagonal length of the box, used as a length scale

double target_error;
the Solve routine is exited when the step/boxdiag < target_error

int trace;
trace=0/1/2 -> no/short/long printout

SArray1dC rtsexpectedM;
RTs expected (inverses of guesses) in a particular testing scheme

Methods:
~NRegisC()
Destructor

NRegisC(CorrSetC corrset,SArray1dC<RigidTransC> rtguesses,int tr = 0,double err = 2.0*mach_precision,int miniter = -1,int maxiter = 1000)
Constructor. The Guesses that are passed are used to setup the rigid transforms. They are not applied to each view.
The Constructor receives a complete problem specification Each element of corrset.csetsM MUST contain view_a, view_b, seta, setb, wab view_a must be less than view_b The specs will not be changed A default choice for the cm's and moments is made The expected RTs are to be set by using SetExpectedRTs. However they are defaulted to Null Transforms!

void SetExpectedRTs(SArray1dC<RigidTransC> expectedrts)
Used to set the expected RTs.

void InitView(int v,RigidTransC rt,Vector3dC cm,double mass = 1.0,double moment = 1.0)
The user may override the default choices selected in the constructor

SArray1dC<RigidTransC> InitPairwise(void)
Based on pairwise registration the poses are initialized internally and returned Solve it and give the answer ----------------------------

SArray1dC<RigidTransC> Solve(void)
Do it!, by convention the result for view 0 is set to null RigidTransC

RigidTransC Answer(int i)
Supply the result for view i NB: by convention the result for view 0 is set to null RigidTransC

double FinalCost(void)
Return the final cost

double FinalCost(SArray1dC<RigidTransC> rt)
Return the cost of the supplied transform set

void ComputeCM(void)
Compute the CM's, masses and moments

CorresT InitCorres(CorSpecT spec)
Initialize correspondence parameters, the CM must be loaded before this is called

double ShortCost(SArray1dC<ViewT> qin)
Print out the cost as \sqrt(\sum w (y-y)^2 / \sum w), i.e. the rms distance between points Order 1 - low accuracy

double Cost(SArray1dC<ViewT> qin)
Print out the cost as \sqrt(\sum w (y-y)^2 / \sum w), i.e. the rms distance between points Order N - high accuracy

void Graph(double hdid,double cost)
print out some info for graphs

void ComputeForces(CorresT & co,ViewT va,ViewT vb)
Compute the forces for the the supplied views and correspondence

double QC_Step(double htry,double & hdid,double & hnext)
Perform a quality controlled step starting with htry, and returning the actual and next suggested values, return the relative step error - see source code for details

SArray1dC<ViewT> Euler(double step,SArray1dC<ViewT> qin)
Perform one Euler step


Programmer: Andrew Stoddart, Documentation by CxxDoc: Tue Mar 20 10:49:27 2001