21 #ifndef __BIAS_ProjectionParametersSphericalSimple_hh__
22 #define __BIAS_ProjectionParametersSphericalSimple_hh__
24 #include <bias_config.h>
27 #include <Base/Common/BIASpragmaStart.hh>
29 #include <Geometry/ProjectionParametersBase.hh>
53 const double thetaOffs,
56 const unsigned int width,
57 const unsigned int height);
73 virtual double GetDPhi()
const {
return dPhi_;};
76 virtual double GetDTheta()
const {
return dTheta_;};
85 bool IgnoreDistortion =
false)
const;
99 bool IgnoreDistortion =
false)
const;
106 bool IgnoreDistortion =
false)
const;
110 const double& depth = 1.0,
111 bool IgnoreDistortion =
false)
121 void Rescale(
double ratio,
const double offset);
123 void Rescale(
unsigned int width,
unsigned int height);
151 double &phi,
double &theta)
const;
154 inline void Angles2GlobalOrientation(
const double &phi,
168 double &phi,
double &theta)
const;
171 inline void Angles2Local(
const double &phi,
const double &theta,
176 double &theta)
const;
179 inline void Angles2Pixel(
const double &phi,
const double &theta,
183 #ifdef BIAS_HAVE_XML2
186 XMLGetClassName(std::string& TopLevelTag,
double& Version)
const;
189 virtual int XMLOut(
const xmlNodePtr Node,
XMLIO& XMLObject)
const;
192 virtual int XMLIn(
const xmlNodePtr Node,
XMLIO& XMLObject);
210 virtual void ValidatePose();
216 friend std::ostream&
operator<<(std::ostream &os,
235 os <<
"ProjectionParametersSphericalSimple:" << std::endl;
236 os <<
"- phiOffset = " << p.
phiOffset_ << std::endl;
237 os <<
"- thetaOffset = " << p.
thetaOffset_ << std::endl;
238 os <<
"- dPhi = " << p.
dPhi_ << std::endl;
239 os <<
"- dTheta = " << p.
dTheta_ << std::endl;
240 os <<
"- R = " << p.
R_ << std::endl;
267 double &phi,
double &theta)
const
308 double r = local.
NormL2();
309 if (
Equal(r, 0.0)) { BEXCEPTION(
"cannot transform vector of zero length"); }
310 double x = local[0] / r;
311 double y = local[1] / r;
312 double z = local[2] / r;
314 double sin_theta = sin(theta);
315 if (
Equal(sin_theta, 0.)){
318 phi = atan2(y/sin_theta, z/sin_theta);
327 double x = cos(theta);
328 double y = sin(phi)*sin(theta);
329 double z = cos(phi)*sin(theta);
349 const double pi = M_PI;
350 const double two_pi = 2. * M_PI;
351 double mphi(phi), mtheta(theta);
352 while (mphi<-pi) { mphi += two_pi; }
353 while (mphi>pi) { mphi -= two_pi; }
354 while (mtheta<0.) { mtheta += two_pi; }
355 while (mtheta>two_pi) { mtheta -= two_pi; }
357 BEXCEPTION(
"invalid theta: "<<mtheta<<
"\n must be in [0, PI]");
366 #include <Base/Common/BIASpragmaEnd.hh>
void Set(const T *pv)
copy the array of vectorsize beginning at *T to this->data_
class HomgPoint2D describes a point with 2 degrees of freedom in projective coordinates.
void TransposedMult(const Vector3< T > &argvec, Vector3< T > &destvec) const
multiplies matrix from left with transposed argvec, resulting in transposed destvec ...
Slim class bundeling pose parametrization and associated covariance matrix.
Down-, Upsampling routines and Resize.
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. ...
void Mult(const Vector3< T > &argvec, Vector3< T > &destvec) const
matrix - vector multiplicate this matrix with Vector3, storing the result in destvec calculates: dest...
class HomgPoint3D describes a point with 3 degrees of freedom in projective coordinates.
std::ostream & operator<<(std::ostream &os, const Array2D< T > &arg)
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_...
Implements a 3D rotation matrix.
Camera parameters which define the mapping between rays in the camera coordinate system and pixels in...
bool QValid_
validity flag for orientation and position
double NormL2() const
the L2 norm sqrt(a^2 + b^2 + c^2)