Basic Image AlgorithmS Library  2.8.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
ExampleCalcRelativeTransform.cpp

Example for calculation of the relative transform between 2 transforms

Author
MIP
/*
This file is part of the BIAS library (Basic ImageAlgorithmS).
Copyright (C) 2003-2009 (see file CONTACT for details)
Multimediale Systeme der Informationsverarbeitung
Institut fuer Informatik
Christian-Albrechts-Universitaet Kiel
BIAS is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
BIAS is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with BIAS; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/**
@example ExampleCalcRelativeTransform.cpp
@relates CoordinateTransform3D
@brief Example for calculation of the relative transform between 2 transforms
@ingroup g_examples
@author MIP
*/
#include <Geometry/CoordinateTransform3D.hh>
#include <Geometry/Projection.hh>
#include <Utils/Param.hh>
#include <iostream>
using namespace std;
using namespace BIAS;
void commandHelp(char* argv) {
cout<<argv<<" [options] <projection A > <projection B>\n";
}
int main(int argc, char* argv[])
{
Param params(true);
bool* help = params.AddParamBool("help", "", false, 'h');
int fup = params.ParseCommandLine(argc, argv);
if(*help || argc<3) {
commandHelp(argv[0]);
params.Usage();
return 0;
}
Projection A, B;
if(A.Load(argv[fup])!=0) {
cerr<<"error loading projection A\n";
commandHelp(argv[0]);
params.Usage();
return -1;
}
if(B.Load(argv[fup+1])!=0) {
cerr<<"error loading projection B\n";
commandHelp(argv[0]);
params.Usage();
return -1;
}
Pose poseA, poseB, result, check;
poseA = A.GetPose();
poseB = B.GetPose();
cout<<" PoseA = ";
poseA.Talk();
cout<<" PoseB = ";
poseB.Talk();
cout<<"calculating relative transformations between A and B:\n\n";
cout<<"making A global: A*result = B :\n";
result.BecomeRelativeTransform(poseB, poseA);
result.Talk();
cout<<endl;
// cout<<"check should be B : ";
// poseA.ConcatenateLocalTransform(result, check);
// check.Talk();
// cout<<endl;
cout<<"making B global: B*result = A :\n";
result.BecomeRelativeTransform(poseA, poseB);
result.Talk();
cout<<endl;
// cout<<"check should be A : ";
// poseB.ConcatenateLocalTransform(result, check);
// check.Talk();
// cout<<endl;
return 0;
}