32 #include <Geometry/Projection.hh>
33 #include <Geometry/ProjectionParametersSpherical.hh>
39 int main (
int argc,
char* argv[])
44 cout <<
"no file given, terminating!"<<endl;
50 cout <<
"Error reading file:" << argv[1] << endl;
54 cout <<
"Read file:" << argv[1] << endl;
57 cout <<
"Projection is: "<<proj1<<endl;
63 double imgsize1,imgsize2, imgsize3;
67 cout <<
"KMatNormal:" << imgsize1 <<
"x" << imgsize1 << K1 << endl;
68 cout <<
"KMatBig:" << imgsize2 <<
"x" << imgsize1 << K2 << endl;
69 cout <<
"KMatSmall:" << imgsize3 <<
"x" << imgsize1 << K3 << endl;
71 for (
int i=0; i<6; i++) {
74 -M_PI*
double(i)*M_PI/3.0,
76 cout <<
"Creating perspective cutout " << i <<
" with center:"
77 << pps->
ProjectLocal(rpt.CoordSphereToEuclidean()) << endl;
81 ss <<
"PerspectiveCutOut" << i <<
".xml";
82 p.XMLWrite(ss.str().c_str());
83 cout <<
"wrote " << ss.str().c_str() << endl;
90 cout <<
"My Projection flat as string: "<<flat<<endl;
92 proj1.
XMLWrite(
"PassedThroughString.xml");
99 p3d[0] = 10.0; p3d[1] = 11.0; p3d[2] = -10.0; p3d[3] = 1.0;
102 cout <<p3d<<
" -> "<<p2d<<endl;
105 cout <<
"CamDataTest.xml created" << endl;
107 proj2.
XMLRead(
"CamDataTest.xml");
108 proj2.
XMLWrite(
"CamDataTestRewrite.xml");
109 cout <<
"CamDataTestRewrite.xml created" << endl;
int XMLReadFromString(const std::string &str)
reconstruct xml tree from string
class HomgPoint2D describes a point with 2 degrees of freedom in projective coordinates.
int XMLRead(const std::string &Filename)
derived classes must implement the function XMLIn which is called by this function XMLRead to read ev...
camera parameters which define the mapping between rays in the camera coordinate system and pixels in...
virtual BIAS::Matrix3x4< double > GetExternals() const
Return cached 3x4 representation of external matrix [R|C].
int XMLWriteToString(std::string &str, std::string encoding="UTF-8") const
serialize xml tree to string
const ProjectionParametersBase * GetParameters(unsigned int cam=0) const
const parameter access function
This class hides the underlying projection model, like projection matrix, spherical camera...
int XMLWrite(const std::string &Filename, int CompressionLevel=0, bool AutoAddCompressionSuffix=true, std::string encoding="UTF-8") const
call this to add the class to a new xml tree and write it to the file Filename.
class HomgPoint3D describes a point with 3 degrees of freedom in projective coordinates.
K describes the mapping from world coordinates (wcs) to pixel coordinates (pcs).
virtual HomgPoint2D Project(const HomgPoint3D &X, unsigned int cam=0, bool IgnoreDistortion=false) const
returns the 2d projection of X in camera cam, where X is given in the global coordinate frame (not th...
int ReadFromCamParamFile(const std::string &filename, const bool silent=false)
Reads a camera data XML file and constructs the ProjectionParametersBase-pointer, using the Projectio...