26 #include "Geometry/ProjectionParametersProjective.hh"
33 int ProjectionParametersProjective::
35 bool IgnoreDistortion)
const
37 BIASERR(
"No local projection possible in projective case!!!");
44 UnProjectToImagePlane(
const HomgPoint2D& pos,
const double& depth,
45 bool IgnoreDistortion)
const
56 BIASERR(
"not implemented in projective case!!!")
63 bool ProjectionParametersProjective::
66 BIASERR(
"Cannot distort in projective case!!!");
72 bool ProjectionParametersProjective::
75 BIASERR(
"Cannot undistort in projective case!!!");
84 BIASERR(
"covariance propagation for projective space not implemented");
90 int ProjectionParametersProjective::XMLGetClassName(std::string& TopLevelTag,
91 double& Version)
const {
92 TopLevelTag =
"ProjectionParametersProjective";
97 int ProjectionParametersProjective::XMLOut(
const xmlNodePtr Node,
98 XMLIO& XMLObject)
const {
100 xmlNodePtr childNode;
103 XMLObject.
addAttribute(childNode,
"width", (
int)width_);
104 XMLObject.
addAttribute(childNode,
"height", (
int)height_);
109 stringstream datastream;
111 for (
unsigned int i=0; i<12; i++) {
112 datastream << (double) MatrixCache.
GetData()[i] <<
" ";
114 XMLObject.
addContent(childNode, datastream.str());
118 int ProjectionParametersProjective::XMLIn(
const xmlNodePtr Node,
121 xmlNodePtr childNode;
123 if ((childNode = XMLObject.
getChild(Node,
"ImageSize"))!=NULL) {
130 if ((childNode = XMLObject.
getChild(Node,
"MatrixRows"))==NULL) {
131 BIASERR(
"Error in xml structure.");
137 unsigned int CurrentData=0;
139 while (ssData.good() && CurrentData<12) {
141 MatrixCache.
GetData()[CurrentData++] = buffer;
143 Pose_.SetFromMatrix3x4(MatrixCache);
144 if (CurrentData<12) {
146 BIASERR(
"Error parsing XML code ...");
155 bool ProjectionParametersProjective::
158 bool IgnoreDistortion)
const
161 BIASERR(
"no local projection possible in projective case")
168 bool ProjectionParametersProjective::
171 bool IgnoreDistortion)
const
174 if(width_ != 0 && height_ !=0){
178 return (x[0]>=-0.5 && x[1]>=-0.5 &&
179 x[0]<=(
double)(width_)-0.5 && x[1]<=(
double)(height_)-0.5 );
181 BIASERR(
"Image width and height need to be set for this method!!!")
Vector< double > GetNullvector(const int last_offset=0)
return one of the nullvectors.
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.
computes and holds the singular value decomposition of a rectangular (not necessarily quadratic) Matr...
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...
void Homogenize()
homogenize class data member elements to W==1 by divison by W
int getAttributeValueInt(const xmlAttrPtr Attribute) const
void addContent(const xmlNodePtr Node, const std::string &Content)
Add content to a node.
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.
T * GetData()
get the pointer to the data array of the matrix (for faster direct memeory access) ...
class HomgPoint3D describes a point with 3 degrees of freedom in projective coordinates.
describes a projective 3D -> 2D mapping in homogenous coordinates
std::string getNodeContentString(const xmlNodePtr Node) const
Get the content of a given Node.