25 #include <Geometry/Projection.hh>
26 #include <Geometry/ProjectionParametersFactory.hh>
27 #include <Geometry/ProjectionParametersPerspective.hh>
28 #include <Geometry/ProjectionParametersPerspectiveDepth.hh>
29 #include <Geometry/ProjectionParametersProjective.hh>
30 #include <Geometry/ProjectionParametersSphericalFast.hh>
31 #include <Geometry/ProjectionParametersSpherical.hh>
32 #include <Geometry/ProjectionParametersCylindric.hh>
33 #include <Geometry/ProjectionParametersGreatCircles.hh>
34 #include <Geometry/ProjectionParametersSphericalSimple.hh>
35 #include <Geometry/ProjectionParametersZoom.hh>
37 #ifdef BUILD_DYNAMIC_LOAD_PROJECTION
38 #include <Geometry/ProjectionParametersDynamicLoad.hh>
46 ValidClassNames_.push_back(
"ProjectionParametersPerspective");
47 ValidClassNames_.push_back(
"ProjectionParametersPerspectiveDepth");
48 ValidClassNames_.push_back(
"ProjectionParametersProjective");
49 ValidClassNames_.push_back(
"ProjectionParametersSpherical");
50 ValidClassNames_.push_back(
"ProjectionParametersSphericalFast");
51 ValidClassNames_.push_back(
"ProjectionParametersCylindric");
52 ValidClassNames_.push_back(
"ProjectionParametersGreatCircles");
53 ValidClassNames_.push_back(
"ProjectionParametersZoom");
54 ValidClassNames_.push_back(
"ProjectionParametersSphericalSimple");
58 ValidClassNames_.clear();
64 if (className ==
"ProjectionParametersPerspective")
66 if (className ==
"ProjectionParametersPerspectiveDepth")
68 if (className ==
"ProjectionParametersProjective")
70 if (className ==
"ProjectionParametersSphericalFast")
72 if (className ==
"ProjectionParametersSpherical")
74 if (className ==
"ProjectionParametersCylindric")
76 if (className ==
"ProjectionParametersGreatCircles")
78 if (className ==
"ProjectionParametersZoom")
80 if (className ==
"ProjectionParametersSphericalSimple")
83 #ifdef BUILD_DYNAMIC_LOAD_PROJECTION
91 BIASERR(
"Invalid projection parameters class: " << className);
111 std::vector<CPDiscreteParam>::iterator it;
140 BIASERR(
"Aspect ratio and cellsizes do not match!");
158 #ifdef BIAS_HAVE_XML2
161 rootNode = myXML.
read(fileName);
162 if (rootNode==NULL) {
163 BIASERR(
"Projection parameter XML file "<<fileName<<
" not found or parse error!");
167 if (className ==
"Projection") {
168 BIASERR(
"Trying to load projection parameters from projection XML file "
169 <<fileName<<
", trying to read projection instead!");
171 if (proj.
Load(fileName) != 0) {
172 if (proj.
Size() > 0) {
180 BIASERR(
"Unknown projection parameters type "<<className<<
" found in XML file "
184 int res = ppb->
XMLIn(rootNode, myXML);
186 BIASERR(
"Error reading projection parameters type "<<className<<
" from XML file "
194 BIASERR(
"Error reading projection parameters from file "<<fileName
195 <<
", trying to read camera instead!");
200 return Create(camData);
203 #else // BIAS_HAVE_XML2
204 BIASERR(
"you need XML2");
207 #endif // BIAS_HAVE_XML2
can load exernally programmed child classes of ProjectionParametersBase
ProjectionParametersFactory()
virtual void SetPrincipal(const double x, const double y)
Set principal point (in pixels relative to top left corner).
void SetXYZ(ROTATION_MATRIX_TYPE PhiX, ROTATION_MATRIX_TYPE PhiY, ROTATION_MATRIX_TYPE PhiZ)
Set Euler angles (in rad) in order XYZ.
static int ReadCameraData(const std::string &Filename, CameraData &cd, const bool silent=false)
Read a camera data parameter file and store the data in (*this)
xmlNodePtr read(const std::string &Filename)
Read and parse an XML file from disk, DtD validation is not yet implemented.
virtual int Load(const std::string &filename)
convenience wrapper which tries to read different formats
additional depth calibration parameters for a perspective depth camera to be used for ToF-(PMD) camer...
ProjectionParametersBase * Create(const std::string &className)
Creates a projection parameters object by a class name.
camera parameters which define the mapping between rays in the camera coordinate system and pixels in...
camera parameters which define the mapping between rays in the camera coordinate system and pixels in...
virtual void SetImageSize(const unsigned int w, const unsigned int h)
Set image dimensions (in pixels).
void SetUndistortion(double kc1, double kc2)
virtual int XMLIn(const xmlNodePtr Node, XMLIO &XMLObject)
Specialization of XML read function.
std::vector< double > AngleCorrX_
spherical camera that samples along big circles containig the H vector.
int GetQuaternion(Quaternion< ROTATION_MATRIX_TYPE > &quat) const
Calculates quaternion representation for this rotation matrix.
ProjectionParametersBase * Load(const std::string &fileName)
Loads a projection parameters object from a file.
virtual void SetQ(const BIAS::Quaternion< double > &Q)
Set orientation from unit quaternion Q.
BIAS::Vector3< double > PoseInRigCenter_
Wrapper class for reading and writing XML files based on the XML library libxml2. ...
This class hides the underlying projection model, like projection matrix, spherical camera...
12 parametric p for completely projective reconstruction scenarios, unknown focal lengths...
std::vector< CPDiscreteParam > knownparams_vect_
~ProjectionParametersFactory()
Camera parameters which define the mapping between rays in the camera coordinate system and pixels in...
std::string getNodeName(const xmlNodePtr Node) const
Get the name of a given Node.
std::vector< double > AngleCorrY_
int AddZoomStep(double zoom, double focallength, double kc1, double kc2, double kc3, double kc4)
unsigned int Size() const
Determine number of ProjectionParameterBase pointers in Projection.
virtual void SetAspectratio(const double AspectRatio)
Set CCD aspect ratio (i.e.
void SetFocalLengthAndAspect(double f, double AspectRatio)
Set the current camera focal length in pixel and the a spect ratio.
Camera parameters which define the mapping between rays in the camera coordinate system and pixels in...
ProjectionParametersBase * GetParameterCloneWithAbsolutePose(unsigned int cam=0) const
Allocates memory for parameters base type and returns pointer to it!
virtual void SetC(const BIAS::Vector3< double > &C)
Set projection center.
ProjectionParametersBase * GetDynPtr()
get base pointer to dynamically loaded object in order to handle it directly