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

Example for generating synthetic matches

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 ExampleGenSynthMatches.cpp
* @relates GenSynthMatches
@ingroup g_examples
@brief Example for generating synthetic matches
@author MIP */
#include <iostream>
#include <Base/Common/BIASpragma.hh>
#include <Utils/GenSynthMatches.hh>
#include <Base/Image/ImageIO.hh>
using namespace BIAS;
using namespace std;
#define DEFAULT_PARA_FILE_NAME "GenSynthMatches.ini"
#define DEBUG true
int main(int argc, char *argv[])
{
Param para;
GenSynthMatches gsm(para), gsm2(para);
// gsm.AddDebugLevel(GSM_CAM_MOTION);
// gsm.AddDebugLevel(GSM_VIEWINGVOL);
// gsm.AddDebugLevel(GSM_3D_POINTS);
// gsm.AddDebugLevel(GSM_2D_MATCHES);
gsm.AddDebugLevel(GSM_MOVIN_TRANSF);
//gsm.AddDebugLevel(GSM_MOVIN_3D_POINTS);
bool FoundDefaultParaFile=true;
ifstream is(DEFAULT_PARA_FILE_NAME);
if (!is){
is.close();
if (DEBUG) cerr << "reading "<<DEFAULT_PARA_FILE_NAME<<" failed"<<endl;
FoundDefaultParaFile=false;
} else {
if (DEBUG) cerr << "reading "<<DEFAULT_PARA_FILE_NAME<<endl;
para.ReadParameter(DEFAULT_PARA_FILE_NAME);
}
int argind = para.ParseCommandLine(argc, argv);
if (argind<0){
BIASERR("error parsing command line");
return -1;
}
if ((!FoundDefaultParaFile) && (*para.GetParamString("readconfig")=="")) {
cerr << "no parameter file found, writing default to "
<<DEFAULT_PARA_FILE_NAME<<"\n";
para.SetWriteOptions(true, false, false);
para.WriteParameter(DEFAULT_PARA_FILE_NAME);
}
gsm.CreateMatches();
//cout << gsm <<endl;
gsm.Write("data.txt");
gsm.CreateGTVRML("gsm-gt.wrl");
//gsm2.Read("data.txt");
//cout << gsm2 <<endl;
// cout << gsm._MovingTransform[2] << endl;
// cout << gsm2._MovingTransform[2] << endl;
gsm.DrawTrue(im, 0, 1);
//ImageIO::Save("true.mip", im);
ImageIO::Save("true.mip", im);
gsm.DrawNoisy(im, 0, 1);
//ImageIO::Save("noisy.mip", im);
ImageIO::Save("noisy.mip", im);
// gsm2.DrawTrue(im, 0, 1);
// ImageIO::Save("true2.mip", im);
// gsm2.DrawNoisy(im, 0, 1);
// ImageIO::Save("noisy2.mip", im);
return 0;
}