2 #include "Geometry/ProjectionParametersSphericalSimple.hh"
4 #include <Base/Debug/Exception.hh>
10 ProjectionParametersSphericalSimple::
11 ProjectionParametersSphericalSimple()
13 dPhi_(0.0), dTheta_(0.0)
18 const double thetaOffs,
21 const unsigned int width,
22 const unsigned int height)
24 phiOffset_(phiOffs), thetaOffset_(thetaOffs), dPhi_(dPhi), dTheta_(dTheta)
29 const double pi = M_PI;
30 const double two_pi = 2. * M_PI;
56 bool IgnoreDistortion)
const
58 if (fabs(point.
NormL2())<1e-6) {
64 p2d.
Set(pixel[0], pixel[1], 1.0);
78 BEXCEPTION(
"cannot unproject point at infinity "<<pos);
87 Rescale(
double ratio,
const double offset)
96 unsigned int oldwidth =
width_;
106 bool IgnoreDistortion)
const
111 double r = localv.
NormL2();
130 return((x[0]>=0.0)&&(x[0]+1.0<=
width_)&&
131 (x[1]>=0.0)&&(x[1]+1.0<=
height_));
135 #ifdef BIAS_HAVE_XML2
140 TopLevelTag =
"ProjectionParametersSphericalSimple";
173 BIASERR(
"error getting \"Version\" attribute of \n");
177 if (VersionInFile<Version){
178 BEXCEPTION(
"Cannot read old version "<<VersionInFile
179 <<
" of ProjectionParametersSphericalSimple");
182 xmlNodePtr childNode;
183 if ((childNode = XMLObject.
getChild(Node, TopLevelName))==NULL) {
184 BIASERR(
"Error in xml, no tag" << TopLevelName);
208 const double pi = M_PI;
209 const double two_pi = 2. * M_PI;
220 #endif // BIAS_HAVE_XML2
void addAttribute(const xmlNodePtr Node, const std::string &AttributeName, bool AttributeValue)
Add an attribute to a node.
class HomgPoint2D describes a point with 2 degrees of freedom in projective coordinates.
virtual void SetR(const BIAS::RMatrix &R)
Set orientation from rotation matrix R.
virtual int XMLOut(const xmlNodePtr Node, XMLIO &XMLObject) const
Specialization of XML write function.
xmlNodePtr getChild(const xmlNodePtr ParentNode, const std::string &ChildName)
Get a child of a Parent node by specifying the childs name, NULL is returned if the ParentNode has no...
virtual void Rescale(double ratio, const double offset=0.0)
Adapt internal parameters to resampled image.
Slim class bundeling pose parametrization and associated covariance matrix.
virtual int XMLIn(const xmlNodePtr Node, XMLIO &XMLObject)
Specialization of XML read function.
virtual void SetPose(const BIAS::Pose pose)
Set pose from pose object.
virtual void SetQ(const BIAS::Quaternion< double > &Q)
Set orientation from unit quaternion Q.
Represents 3d pose transformations, parametrized as Euclidean translation and unit quaternion orienta...
Wrapper class for reading and writing XML files based on the XML library libxml2. ...
xmlNodePtr addChildNode(const xmlNodePtr ParentNode, const std::string &NewNodeName)
Add a child node to an incoming node with the given name.
bool IsAtInfinity() const
unsigned int height_
height of image in pixels
virtual BIAS::RMatrix GetR() const
Get orientation as rotation matrix R.
class HomgPoint3D describes a point with 3 degrees of freedom in projective coordinates.
bool Equal(const T left, const T right, const T eps)
comparison function for floating point values See http://www.boost.org/libs/test/doc/components/test_...
xmlAttrPtr getAttributeByName(const xmlNodePtr Node, const std::string &attribute_name)
search for a specific attribute
unsigned int width_
width of image in pixels
double getAttributeValueDouble(const xmlAttrPtr Attribute) const
virtual void ValidatePose()
Validate currently set pose.
virtual void SetQC(const BIAS::Quaternion< double > &Q, const BIAS::Vector3< double > &C)
Set pose from unit quaternion Q and projection center C.
virtual int XMLGetClassName(std::string &TopLevelTag, double &Version) const
Specialization of XML block name function.
Camera parameters which define the mapping between rays in the camera coordinate system and pixels in...
void Set(const HOMGPOINT2D_TYPE &x, const HOMGPOINT2D_TYPE &y)
set elementwise with given 2 euclidean scalar values.
virtual void SetPoseParametrization(const BIAS::PoseParametrization &pp)
Set pose from pose parametrization.
double NormL2() const
the L2 norm sqrt(a^2 + b^2 + c^2)
class BIASGeometryBase_EXPORT HomgPoint3D