Basic Image AlgorithmS Library  2.8.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
ExampleMatchDataBase.cpp
1 /*
2 This file is part of the BIAS library (Basic ImageAlgorithmS).
3 
4 Copyright (C) 2003-2009 (see file CONTACT for details)
5  Multimediale Systeme der Informationsverarbeitung
6  Institut fuer Informatik
7  Christian-Albrechts-Universitaet Kiel
8 
9 
10 BIAS is free software; you can redistribute it and/or modify
11 it under the terms of the GNU Lesser General Public License as published by
12 the Free Software Foundation; either version 2.1 of the License, or
13 (at your option) any later version.
14 
15 BIAS is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU Lesser General Public License for more details.
19 
20 You should have received a copy of the GNU Lesser General Public License
21 along with BIAS; if not, write to the Free Software
22 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 */
24 
25 /** @example ExampleMatchDataBase.cpp
26  * @relates MatchDataBase, GenSynthMatches
27  @ingroup g_examples
28  @brief Example for generating synthetic matches using database
29  @author MIP */
30 
31 #include <Utils/MatchDataBase.hh>
32 #include <Utils/GenSynthMatches.hh>
33 
34 #include <Base/Common/BIASpragma.hh>
35 #include <iostream>
36 
37 using namespace BIAS;
38 using namespace std;
39 
40 int main(int argc, char *argv[])
41 {
42  Param para;
43  GenSynthMatches gsm(para);
44  gsm.CreateMatches();
45  const string fname="mdb.txt";
46 
47  gsm.Write(fname);
48 
49  std::cout << "original: \n"<<gsm << endl;
50 
51  MatchDataBase mdb(para), mdb2(para), mdb3(para);
52  mdb.Read(fname);
53 
54  std::cout << "read: \n"<< mdb << endl;
55 
56  KMatrix K;
57  vector<RMatrixBase> R;
58  vector<HomgPoint3D> C;
59  vector<vector<HomgPoint2D> > p, np;
60  gsm.GetK(K);
61  gsm.GetR(R);
62  gsm.GetC(C);
63  gsm.GetPoints(p);
64  gsm.GetNormalizedPoints(np);
65  mdb2.SetData(K, R, C, p);
66 
67  std::cout << "SetData: \n"<< mdb2 <<endl;
68 
69  mdb3.SetNormalizedData(K, R, C, np);
70 
71  std::cout << "SetNormalizedData: \n"<< mdb3 <<endl;
72 
73 
74  std::cout << "read: "<<boolalpha<<(gsm==mdb)<<endl;
75  std::cout << "SetData: "<<boolalpha<<(gsm==mdb2)<<endl;
76  std::cout << "SetNormalizedData: "<<boolalpha<<(gsm==mdb3)<<endl;
77 
78  return 0;
79 }
class for generating synthetic matches
class for representing matches, used in GenSynthMatches and biasshowsm
This class Param provides generic support for parameters.
Definition: Param.hh:231
K describes the mapping from world coordinates (wcs) to pixel coordinates (pcs).
Definition: KMatrix.hh:48