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

small example demonstrating the ProjectionParametersSpherical

Author
ischiller 10/2009
/*
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 ExampleProjectionParametersSpherical.cpp
@relates ProjectionParametersSpherical
@brief small example demonstrating the ProjectionParametersSpherical
@ingroup g_examples
@author ischiller 10/2009
*/
#include <Geometry/ProjectionParametersSpherical.hh>
#include <Base/Image/Image.hh>
#include <Base/Image/ImageIO.hh>
using namespace BIAS;
using namespace std;
int main(int argc, char *argv[])
{
int ImgWidth=800, ImgHeight=800;
pps.SetImageSize(ImgWidth,ImgHeight);
pps.SetPrincipal(ImgWidth/2,ImgHeight/2);
std::vector<double> corrX, corrY;
double maxAngle = 180;
corrX.push_back(0.0);
corrX.push_back(M_PI*maxAngle/90.0);
corrY.push_back(0.0);
corrY.push_back(M_PI*maxAngle/180.0);
pps.SetUndistortion(corrX, corrY, 356.0);
std::vector<double> coeffs(4);
coeffs[0] = 1.0;
coeffs[1] = 0.0;
coeffs[2] = 0.0;
coeffs[3] = 0.0;
pps.SetRadius(350);
pps.InitAngleCorrFromPoly(90.0*M_PI/180.0,coeffs);
#ifdef BIAS_HAVE_XML2
string fname = "ProjParSphericalExample01.xml";
int res = pps.XMLWrite(fname);
if (res!=0)
{
cerr << "error writing "<< fname << endl;
return -3;
}
cout << "XMLWrite wrote "<< fname << endl;
res = pps.XMLRead(fname);
if (res!=0)
{
cerr << "error reading "<< fname << endl;
return -3;
}
cout << "XMLWrite read "<< fname << endl;
cout<<pps<<endl;
#else
cout<<"did not XMLWrite because BIAS_HAVE_XML2 not available."<<endl;
#endif
return 0;
}