Basic Image AlgorithmS Library  2.8.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
ExampleLoadBOG.cpp
1 /* This file is part of the BIAS library (Basic ImageAlgorithmS).
2 
3  Copyright (C) 2003-2009 (see file CONTACT for details)
4  Multimediale Systeme der Informationsverarbeitung
5  Institut fuer Informatik
6  Christian-Albrechts-Universitaet Kiel
7 
8 
9  BIAS is free software; you can redistribute it and/or modify
10  it under the terms of the GNU Lesser General Public License as published by
11  the Free Software Foundation; either version 2.1 of the License, or
12  (at your option) any later version.
13 
14  BIAS is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  GNU Lesser General Public License for more details.
18 
19  You should have received a copy of the GNU Lesser General Public License
20  along with BIAS; if not, write to the Free Software
21  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
22 
23 /**
24  @example ExampleLoadBOG.cpp
25  @relates BogIO, Matrix3x3
26  @brief Shows how to read the BOG format which is used by DaimlerChrysler.
27  @ingroup g_examples
28  @author Jan Woetzel
29 */
30 
31 // STD
32 #include <Base/Common/BIASpragma.hh>
33 
34 #include <iostream>
35 #include <fstream>
36 #include <string>
37 #include <vector>
38 
39 
40 // BIAS
41 #include <Base/Math/Vector3.hh>
42 #include <Base/Math/Matrix3x3.hh>
43 #include <Base/Math/BogIO.hh>
44 
45 
46 using namespace std;
47 using namespace BIAS;
48 
49 int main(int argc, char** argv){
50  cout<<"started "<<argv[0]<<endl;
51 #ifdef BIAS_TESTS_DATA
52  string filename(BIAS_TESTS_DATA "calib01.bog");
53 #else
54  string filename("calib01.bog");
55  cout<<"BIAS_TESTS_DATA not defined."<<endl;
56  return -1;
57 #endif
58  if (argc>1) filename=argv[1];
59  cout<<"using filename "<<filename<<endl;
60 
61  //bool ok=true;
62 
64  if (0!=C.LoadBogTC(filename)) return -2;
65  cout<<"C: "<<C<<endl;
66 
68  if (0!=LoadBogRC(filename, R)) return -3;
69  cout<<"R: "<<R<<endl;
70 
72  if (0!=LoadBogK(filename, K)) return -3;
73  cout<<"K: "<<K<<endl;
74 
75  // check values for correctness:
76  int result=0;
77  const double v[3] = { -317.4137573 , 0.4055223 , -3.9081306 };
78  const double eps=1E-10; // desired precision
79  for (unsigned int i=0; i<3; i++) {
80  if (fabs(v[i] - C.GetData()[i]) >eps){
81  cout<<"Error: mismatch for element "<<i<<" : "<<endl
82  <<" should be: "<<v[i]
83  <<" but read : "<<C.GetData()[i]
84  <<endl;
85  result += -1*i;
86  }
87  }
88  cout<<"done with result="<<result<<endl;
89  return result; // OK.
90 }
int LoadBogTC(const std::string &filename)
reads the TC part of a BOG file which is used by Daimler Chrysler for storing Camera center position...
Definition: Vector3.cpp:161
const T * GetData() const
get the data pointer the member function itself is const (before {..}) because it doesn&#39;t change the ...
Definition: Vector3.hh:202
int LoadBogK(const std::string &filename, Matrix3x3< T > &mat)
Definition: BogIO.hh:91
int LoadBogRC(const std::string &filename, Matrix3x3< T > &mat)
Definition: BogIO.hh:17