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

Shows how to read the BOG format which is used by DaimlerChrysler.

, Matrix3x3

Author
Jan Woetzel
/* 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 ExampleLoadBOG.cpp
@relates BogIO, Matrix3x3
@brief Shows how to read the BOG format which is used by DaimlerChrysler.
@ingroup g_examples
@author Jan Woetzel
*/
// STD
#include <Base/Common/BIASpragma.hh>
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
// BIAS
#include <Base/Math/Vector3.hh>
#include <Base/Math/Matrix3x3.hh>
#include <Base/Math/BogIO.hh>
using namespace std;
using namespace BIAS;
int main(int argc, char** argv){
cout<<"started "<<argv[0]<<endl;
#ifdef BIAS_TESTS_DATA
string filename(BIAS_TESTS_DATA "calib01.bog");
#else
string filename("calib01.bog");
cout<<"BIAS_TESTS_DATA not defined."<<endl;
return -1;
#endif
if (argc>1) filename=argv[1];
cout<<"using filename "<<filename<<endl;
//bool ok=true;
if (0!=C.LoadBogTC(filename)) return -2;
cout<<"C: "<<C<<endl;
if (0!=LoadBogRC(filename, R)) return -3;
cout<<"R: "<<R<<endl;
if (0!=LoadBogK(filename, K)) return -3;
cout<<"K: "<<K<<endl;
// check values for correctness:
int result=0;
const double v[3] = { -317.4137573 , 0.4055223 , -3.9081306 };
const double eps=1E-10; // desired precision
for (unsigned int i=0; i<3; i++) {
if (fabs(v[i] - C.GetData()[i]) >eps){
cout<<"Error: mismatch for element "<<i<<" : "<<endl
<<" should be: "<<v[i]
<<" but read : "<<C.GetData()[i]
<<endl;
result += -1*i;
}
}
cout<<"done with result="<<result<<endl;
return result; // OK.
}