25 #include "Geometry/ProjectionParametersOrthographic.hh"
32 BIASERR(
"no distortion for orthographic projection implemented");
38 BIASERR(
"no undistortion for orthographic projection implemented");
45 BIASASSERT(IgnoreDistortion);
47 p[0] = (pos[0]-principalX_)*dX_ + rayDir_[0]*depth;
48 p[1] = (pos[1]-principalY_)*dY_ + rayDir_[1]*depth;
49 p[2] = rayDir_[2]*depth;
51 return Pose_.LocalToGlobal(local);
56 BIASASSERT(IgnoreDistortion);
59 res[1] = point[2]/rayDir_[2];
60 res[0] = (point[0] - rayDir_[0]*res[1])/dX_+principalX_;
61 res[1] = (point[1] - rayDir_[1]*res[1])/dY_+principalY_;
66 if(PPB::DoIntrinsicsDiffer(p)){
69 const PPO* ppo =
dynamic_cast<const PPO*
>(p);
73 if(dX_ != ppo->
dX_ || dY_ != ppo->
dY_){
85 BIASASSERT(IgnoreDistortion);
86 p = ProjectLocal(localP, IgnoreDistortion);
88 return (p[0] >= 0.0 && p[1] >= 0.0 &&
89 p[0] <= (
double)(width_-1) && p[1] <= (
double)(height_-1));
95 TopLevelTag =
"ProjectionParametersOrthographic";
104 PPB::XMLGetClassName(TopLevelName, Version);
107 PPB::XMLOut(theNode, XMLObject);
119 PPB::XMLGetClassName(TopLevelName, Version);
120 xmlNodePtr childNode = XMLObject.
getChild(Node, TopLevelName);
122 BIASERR(
"Error in XML, tag " << TopLevelName <<
" not found!");
125 if(PPB::XMLIn(childNode, XMLObject) != 0){
135 #endif // BIAS_HAVE_XML2
HomgPoint3D UnProjectToImagePlane(const HomgPoint2D &pos, const double &depth=1.0, bool IgnoreDistortion=true) const
map points from image onto unit diameter image plane in 3D.
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.
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...
HomgPoint2D & Homogenize()
homogenize class data member elements to W==1 by divison by W
virtual int XMLIn(const xmlNodePtr Node, XMLIO &XMLObject)
specialization of XML read function
virtual int XMLOut(const xmlNodePtr Node, XMLIO &XMLObject) const
specialization of XML write function
Camera parameters which define the mapping between rays in the camera coordinate system and pixels in...
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.
Vector3< double > rayDir_
virtual bool Distort(HomgPoint2D &point2d) const
Interface defintion for lens distortion function, implemented by derived classes. ...
virtual int XMLGetClassName(std::string &TopLevelTag, double &Version) const
specialization of XML block name function
class HomgPoint3D describes a point with 3 degrees of freedom in projective coordinates.
virtual bool Undistort(HomgPoint2D &point2d) const
Interface defintion for lens undistortion function, implemented by derived classes.
double getAttributeValueDouble(const xmlAttrPtr Attribute) const
bool DoesPointProjectIntoImageLocal(const Vector3< double > &localP, HomgPoint2D &p, bool IgnoreDistortion=true) const
Checks if 3D point projects into specified image and returns belonging 2D image point.
Camera parameters which define the mapping between rays in the camera coordinate system and pixels in...
virtual HomgPoint2D ProjectLocal(const Vector3< double > &point, bool IgnoreDistortion=true) const
calculates the projection of a point in the camera coordinate system to a pixel in the image plane of...
virtual const bool DoIntrinsicsDiffer(const PPB *p) const