2 #include "CylinderMapping.hh"
9 static double toDeg(
const double rad) {
10 return (rad / M_PI * 180.0);
13 static double toRad(
const double deg) {
14 return (M_PI / 180.0 * deg);
19 v.
Set(v[2] * sin(rad) + v[0] * cos(rad),
21 v[2] * cos(rad) - v[0] * sin(rad));
49 const double in_py_) {
60 camAngleX = toDeg(atan(width_ * 0.5 / focalX_)) * 2.0;
63 double px=px_, py=py_;
64 if (px==-1) px = (width_-1) / 2.0;
65 if (py==-1) py = (height_-1) / 2.0;
71 rotateY(v1, toRad(-camAngleX / 2.0));
73 double origWidth = fabs(v1[0] * (1.0 / v1[2])) * 2.0;
75 rotateY(v1, toRad(sink[0] / (
double) width_ * camAngleX));
76 v1[1] = normsink[1] - 0.5;
78 double lambda = 1.0 / v1[2];
79 source[0] = lambda * v1[0];
80 source[1] = lambda * v1[1];
82 source[0] = (source[0] / origWidth + 0.5) * width_;
83 source[1] = (source[1] + 0.5) * height_;
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 setFocalLength(const double fx, const double fy)
Set the focal length of the camera.
void Reset()
if you want to call Map() twice for this object with different params, call Reset() before ...
virtual int GetSourceCoordinates_(const BIAS::HomgPoint2D &sink, BIAS::HomgPoint2D &source) const
this does the trick
void setPrincipalPoint(const double px, const double py)
Set the principal point of the camera.