gtsam  3.2.1
gtsam
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PinholeCamera.h
Go to the documentation of this file.
1 /* ----------------------------------------------------------------------------
2 
3  * GTSAM Copyright 2010, Georgia Tech Research Corporation,
4  * Atlanta, Georgia 30332-0415
5  * All Rights Reserved
6  * Authors: Frank Dellaert, et al. (see THANKS for the full author list)
7 
8  * See LICENSE for the license information
9 
10  * -------------------------------------------------------------------------- */
11 
19 #pragma once
20 
21 #include <cmath>
22 #include <boost/optional.hpp>
23 #include <boost/serialization/nvp.hpp>
24 #include <gtsam/base/DerivedValue.h>
25 #include <gtsam/base/Vector.h>
26 #include <gtsam/base/Matrix.h>
27 #include <gtsam/geometry/Point2.h>
28 #include <gtsam/geometry/Pose2.h>
29 #include <gtsam/geometry/Pose3.h>
31 
32 namespace gtsam {
33 
39 template<typename Calibration>
40 class PinholeCamera: public DerivedValue<PinholeCamera<Calibration> > {
41 private:
42  Pose3 pose_;
43  Calibration K_;
44 
45 public:
46 
49 
52  }
53 
55  explicit PinholeCamera(const Pose3& pose) :
56  pose_(pose) {
57  }
58 
60  PinholeCamera(const Pose3& pose, const Calibration& K) :
61  pose_(pose), K_(K) {
62  }
63 
67 
75  static PinholeCamera Level(const Calibration &K, const Pose2& pose2,
76  double height) {
77  const double st = sin(pose2.theta()), ct = cos(pose2.theta());
78  const Point3 x(st, -ct, 0), y(0, 0, -1), z(ct, st, 0);
79  const Rot3 wRc(x, y, z);
80  const Point3 t(pose2.x(), pose2.y(), height);
81  const Pose3 pose3(wRc, t);
82  return PinholeCamera(pose3, K);
83  }
84 
86  static PinholeCamera Level(const Pose2& pose2, double height) {
87  return PinholeCamera::Level(Calibration(), pose2, height);
88  }
89 
99  static PinholeCamera Lookat(const Point3& eye, const Point3& target,
100  const Point3& upVector, const Calibration& K = Calibration()) {
101  Point3 zc = target - eye;
102  zc = zc / zc.norm();
103  Point3 xc = (-upVector).cross(zc); // minus upVector since yc is pointing down
104  xc = xc / xc.norm();
105  Point3 yc = zc.cross(xc);
106  Pose3 pose3(Rot3(xc, yc, zc), eye);
107  return PinholeCamera(pose3, K);
108  }
109 
113 
114  explicit PinholeCamera(const Vector &v) {
115  pose_ = Pose3::Expmap(v.head(Pose3::Dim()));
116  if (v.size() > Pose3::Dim()) {
117  K_ = Calibration(v.tail(Calibration::Dim()));
118  }
119  }
120 
121  PinholeCamera(const Vector &v, const Vector &K) :
122  pose_(Pose3::Expmap(v)), K_(K) {
123  }
124 
128 
130  bool equals(const PinholeCamera &camera, double tol = 1e-9) const {
131  return pose_.equals(camera.pose(), tol)
132  && K_.equals(camera.calibration(), tol);
133  }
134 
136  void print(const std::string& s = "PinholeCamera") const {
137  pose_.print(s + ".pose");
138  K_.print(s + ".calibration");
139  }
140 
144 
145  virtual ~PinholeCamera() {
146  }
147 
149  inline Pose3& pose() {
150  return pose_;
151  }
152 
154  inline const Pose3& pose() const {
155  return pose_;
156  }
157 
159  inline Calibration& calibration() {
160  return K_;
161  }
162 
164  inline const Calibration& calibration() const {
165  return K_;
166  }
167 
171 
173  inline const PinholeCamera compose(const PinholeCamera &c,
174  boost::optional<Matrix&> H1 = boost::none, boost::optional<Matrix&> H2 =
175  boost::none) const {
176  PinholeCamera result(pose_.compose(c.pose(), H1, H2), K_);
177  if (H1) {
178  H1->conservativeResize(Dim(), Dim());
179  H1->topRightCorner(Pose3::Dim(), Calibration::Dim()) = zeros(Pose3::Dim(),
180  Calibration::Dim());
181  H1->bottomRows(Calibration::Dim()) = zeros(Calibration::Dim(), Dim());
182  }
183  if (H2) {
184  H2->conservativeResize(Dim(), Dim());
185  H2->topRightCorner(Pose3::Dim(), Calibration::Dim()) = zeros(Pose3::Dim(),
186  Calibration::Dim());
187  H2->bottomRows(Calibration::Dim()) = zeros(Calibration::Dim(), Dim());
188  }
189  return result;
190  }
191 
193  inline const PinholeCamera between(const PinholeCamera& c,
194  boost::optional<Matrix&> H1 = boost::none, boost::optional<Matrix&> H2 =
195  boost::none) const {
196  PinholeCamera result(pose_.between(c.pose(), H1, H2), K_);
197  if (H1) {
198  H1->conservativeResize(Dim(), Dim());
199  H1->topRightCorner(Pose3::Dim(), Calibration::Dim()) = zeros(Pose3::Dim(),
200  Calibration::Dim());
201  H1->bottomRows(Calibration::Dim()) = zeros(Calibration::Dim(), Dim());
202  }
203  if (H2) {
204  H2->conservativeResize(Dim(), Dim());
205  H2->topRightCorner(Pose3::Dim(), Calibration::Dim()) = zeros(Pose3::Dim(),
206  Calibration::Dim());
207  H2->bottomRows(Calibration::Dim()) = zeros(Calibration::Dim(), Dim());
208  }
209  return result;
210  }
211 
213  inline const PinholeCamera inverse(
214  boost::optional<Matrix&> H1 = boost::none) const {
215  PinholeCamera result(pose_.inverse(H1), K_);
216  if (H1) {
217  H1->conservativeResize(Dim(), Dim());
218  H1->topRightCorner(Pose3::Dim(), Calibration::Dim()) = zeros(Pose3::Dim(),
219  Calibration::Dim());
220  H1->bottomRows(Calibration::Dim()) = zeros(Calibration::Dim(), Dim());
221  }
222  return result;
223  }
224 
226  inline const PinholeCamera compose(const Pose3 &c) const {
227  return PinholeCamera(pose_.compose(c), K_);
228  }
229 
233 
235  PinholeCamera retract(const Vector& d) const {
236  if ((size_t) d.size() == pose_.dim())
237  return PinholeCamera(pose().retract(d), calibration());
238  else
239  return PinholeCamera(pose().retract(d.head(pose().dim())),
240  calibration().retract(d.tail(calibration().dim())));
241  }
242 
244  Vector localCoordinates(const PinholeCamera& T2) const {
245  Vector d(dim());
246  d.head(pose().dim()) = pose().localCoordinates(T2.pose());
247  d.tail(calibration().dim()) = calibration().localCoordinates(
248  T2.calibration());
249  return d;
250  }
251 
253  inline size_t dim() const {
254  return pose_.dim() + K_.dim();
255  }
256 
258  inline static size_t Dim() {
259  return Pose3::Dim() + Calibration::Dim();
260  }
261 
265 
272  inline static Point2 project_to_camera(const Point3& P,
273  boost::optional<Matrix&> Dpoint = boost::none) {
274 #ifdef GTSAM_THROW_CHEIRALITY_EXCEPTION
275  if (P.z() <= 0)
276  throw CheiralityException();
277 #endif
278  double d = 1.0 / P.z();
279  const double u = P.x() * d, v = P.y() * d;
280  if (Dpoint) {
281  *Dpoint = (Matrix(2, 3) << d, 0.0, -u * d, 0.0, d, -v * d);
282  }
283  return Point2(u, v);
284  }
285 
287  inline std::pair<Point2, bool> projectSafe(const Point3& pw) const {
288  const Point3 pc = pose_.transform_to(pw);
289  const Point2 pn = project_to_camera(pc);
290  return std::make_pair(K_.uncalibrate(pn), pc.z() > 0);
291  }
292 
299  inline Point2 project(
300  const Point3& pw, //
301  boost::optional<Matrix&> Dpose = boost::none,
302  boost::optional<Matrix&> Dpoint = boost::none,
303  boost::optional<Matrix&> Dcal = boost::none) const {
304 
305  // Transform to camera coordinates and check cheirality
306  const Point3 pc = pose_.transform_to(pw);
307 
308  // Project to normalized image coordinates
309  const Point2 pn = project_to_camera(pc);
310 
311  if (Dpose || Dpoint) {
312  const double z = pc.z(), d = 1.0 / z;
313 
314  // uncalibration
315  Matrix Dpi_pn(2, 2);
316  const Point2 pi = K_.uncalibrate(pn, Dcal, Dpi_pn);
317 
318  // chain the Jacobian matrices
319  if (Dpose) {
320  Dpose->resize(2, 6);
321  calculateDpose(pn, d, Dpi_pn, *Dpose);
322  }
323  if (Dpoint) {
324  Dpoint->resize(2, 3);
325  calculateDpoint(pn, d, pose_.rotation().matrix(), Dpi_pn, *Dpoint);
326  }
327  return pi;
328  } else
329  return K_.uncalibrate(pn, Dcal);
330  }
331 
339  const Point3& pw, //
340  boost::optional<Matrix&> Dpose = boost::none,
341  boost::optional<Matrix&> Dpoint = boost::none,
342  boost::optional<Matrix&> Dcal = boost::none) const {
343 
344  if (!Dpose && !Dpoint && !Dcal) {
345  const Point3 pc = pose_.rotation().unrotate(pw); // get direction in camera frame (translation does not matter)
346  const Point2 pn = project_to_camera(pc); // project the point to the camera
347  return K_.uncalibrate(pn);
348  }
349 
350  // world to camera coordinate
351  Matrix Dpc_rot /* 3*3 */, Dpc_point /* 3*3 */;
352  const Point3 pc = pose_.rotation().unrotate(pw, Dpc_rot, Dpc_point);
353 
354  Matrix Dpc_pose = Matrix::Zero(3, 6);
355  Dpc_pose.block(0, 0, 3, 3) = Dpc_rot;
356 
357  // camera to normalized image coordinate
358  Matrix Dpn_pc; // 2*3
359  const Point2 pn = project_to_camera(pc, Dpn_pc);
360 
361  // uncalibration
362  Matrix Dpi_pn; // 2*2
363  const Point2 pi = K_.uncalibrate(pn, Dcal, Dpi_pn);
364 
365  // chain the Jacobian matrices
366  const Matrix Dpi_pc = Dpi_pn * Dpn_pc;
367  if (Dpose)
368  *Dpose = Dpi_pc * Dpc_pose;
369  if (Dpoint)
370  *Dpoint = (Dpi_pc * Dpc_point).block(0, 0, 2, 2); // only 2dof are important for the point (direction-only)
371  return pi;
372  }
373 
379  inline Point2 project2(
380  const Point3& pw, //
381  boost::optional<Matrix&> Dcamera = boost::none,
382  boost::optional<Matrix&> Dpoint = boost::none) const {
383 
384  const Point3 pc = pose_.transform_to(pw);
385  const Point2 pn = project_to_camera(pc);
386 
387  if (!Dcamera && !Dpoint) {
388  return K_.uncalibrate(pn);
389  } else {
390  const double z = pc.z(), d = 1.0 / z;
391 
392  // uncalibration
393  Matrix Dcal, Dpi_pn(2, 2);
394  const Point2 pi = K_.uncalibrate(pn, Dcal, Dpi_pn);
395 
396  if (Dcamera) {
397  Dcamera->resize(2, this->dim());
398  calculateDpose(pn, d, Dpi_pn, Dcamera->leftCols<6>());
399  Dcamera->rightCols(K_.dim()) = Dcal; // Jacobian wrt calib
400  }
401  if (Dpoint) {
402  Dpoint->resize(2, 3);
403  calculateDpoint(pn, d, pose_.rotation().matrix(), Dpi_pn, *Dpoint);
404  }
405  return pi;
406  }
407  }
408 
410  inline Point3 backproject(const Point2& p, double depth) const {
411  const Point2 pn = K_.calibrate(p);
412  const Point3 pc(pn.x() * depth, pn.y() * depth, depth);
413  return pose_.transform_from(pc);
414  }
415 
417  inline Point3 backprojectPointAtInfinity(const Point2& p) const {
418  const Point2 pn = K_.calibrate(p);
419  const Point3 pc(pn.x(), pn.y(), 1.0); //by convention the last element is 1
420  return pose_.rotation().rotate(pc);
421  }
422 
430  double range(
431  const Point3& point, //
432  boost::optional<Matrix&> Dpose = boost::none,
433  boost::optional<Matrix&> Dpoint = boost::none) const {
434  double result = pose_.range(point, Dpose, Dpoint);
435  if (Dpose) {
436  // Add columns of zeros to Jacobian for calibration
437  Matrix& H1r(*Dpose);
438  H1r.conservativeResize(Eigen::NoChange, pose_.dim() + K_.dim());
439  H1r.block(0, pose_.dim(), 1, K_.dim()) = Matrix::Zero(1, K_.dim());
440  }
441  return result;
442  }
443 
451  double range(
452  const Pose3& pose, //
453  boost::optional<Matrix&> Dpose = boost::none,
454  boost::optional<Matrix&> Dpose2 = boost::none) const {
455  double result = pose_.range(pose, Dpose, Dpose2);
456  if (Dpose) {
457  // Add columns of zeros to Jacobian for calibration
458  Matrix& H1r(*Dpose);
459  H1r.conservativeResize(Eigen::NoChange, pose_.dim() + K_.dim());
460  H1r.block(0, pose_.dim(), 1, K_.dim()) = Matrix::Zero(1, K_.dim());
461  }
462  return result;
463  }
464 
472  template<class CalibrationB>
473  double range(
474  const PinholeCamera<CalibrationB>& camera, //
475  boost::optional<Matrix&> Dpose = boost::none,
476  boost::optional<Matrix&> Dother = boost::none) const {
477  double result = pose_.range(camera.pose_, Dpose, Dother);
478  if (Dpose) {
479  // Add columns of zeros to Jacobian for calibration
480  Matrix& H1r(*Dpose);
481  H1r.conservativeResize(Eigen::NoChange, pose_.dim() + K_.dim());
482  H1r.block(0, pose_.dim(), 1, K_.dim()) = Matrix::Zero(1, K_.dim());
483  }
484  if (Dother) {
485  // Add columns of zeros to Jacobian for calibration
486  Matrix& H2r(*Dother);
487  H2r.conservativeResize(Eigen::NoChange,
488  camera.pose().dim() + camera.calibration().dim());
489  H2r.block(0, camera.pose().dim(), 1, camera.calibration().dim()) =
490  Matrix::Zero(1, camera.calibration().dim());
491  }
492  return result;
493  }
494 
502  double range(
503  const CalibratedCamera& camera, //
504  boost::optional<Matrix&> Dpose = boost::none,
505  boost::optional<Matrix&> Dother = boost::none) const {
506  return pose_.range(camera.pose_, Dpose, Dother);
507  }
508 
509 private:
510 
519  template<typename Derived>
520  static void calculateDpose(const Point2& pn, double d, const Matrix& Dpi_pn,
521  Eigen::MatrixBase<Derived> const & Dpose) {
522  // optimized version of derivatives, see CalibratedCamera.nb
523  const double u = pn.x(), v = pn.y();
524  double uv = u * v, uu = u * u, vv = v * v;
525  Eigen::Matrix<double, 2, 6> Dpn_pose;
526  Dpn_pose << uv, -1 - uu, v, -d, 0, d * u, 1 + vv, -uv, -u, 0, -d, d * v;
527  assert(Dpose.rows()==2 && Dpose.cols()==6);
528  const_cast<Eigen::MatrixBase<Derived>&>(Dpose) = //
529  Dpi_pn.block<2, 2>(0, 0) * Dpn_pose;
530  }
531 
540  template<typename Derived>
541  static void calculateDpoint(const Point2& pn, double d, const Matrix& R,
542  const Matrix& Dpi_pn, Eigen::MatrixBase<Derived> const & Dpoint) {
543  // optimized version of derivatives, see CalibratedCamera.nb
544  const double u = pn.x(), v = pn.y();
545  Eigen::Matrix<double, 2, 3> Dpn_point;
546  Dpn_point << //
547  R(0, 0) - u * R(0, 2), R(1, 0) - u * R(1, 2), R(2, 0) - u * R(2, 2), //
548  R(0, 1) - v * R(0, 2), R(1, 1) - v * R(1, 2), R(2, 1) - v * R(2, 2);
549  Dpn_point *= d;
550  assert(Dpoint.rows()==2 && Dpoint.cols()==3);
551  const_cast<Eigen::MatrixBase<Derived>&>(Dpoint) = //
552  Dpi_pn.block<2, 2>(0, 0) * Dpn_point;
553  }
554 
558 
561  template<class Archive>
562  void serialize(Archive & ar, const unsigned int version) {
563  ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP(Value);
564  ar & BOOST_SERIALIZATION_NVP(pose_);
565  ar & BOOST_SERIALIZATION_NVP(K_);
566  }
568  }
569  ;}
Pose3 compose(const Pose3 &p2, boost::optional< Matrix & > H1=boost::none, boost::optional< Matrix & > H2=boost::none) const
compose this transformation onto another (first *this and then p2)
Definition: Pose3.cpp:272
const Rot3 & rotation() const
get rotation
Definition: Pose3.h:261
PinholeCamera(const Pose3 &pose, const Calibration &K)
constructor with pose and calibration
Definition: PinholeCamera.h:60
double range(const Point3 &point, boost::optional< Matrix & > H1=boost::none, boost::optional< Matrix & > H2=boost::none) const
Calculate range to a landmark.
Definition: Pose3.cpp:302
double norm() const
Distance of the point from the origin.
Definition: Point3.cpp:97
typedef and functions to augment Eigen's VectorXd
void print(const std::string &s="") const
print with optional string
Definition: Pose3.cpp:117
const PinholeCamera compose(const Pose3 &c) const
compose two cameras: TODO Frank says this might not make sense
Definition: PinholeCamera.h:226
std::pair< Point2, bool > projectSafe(const Point3 &pw) const
Project a point into the image and check depth.
Definition: PinholeCamera.h:287
Pose3 inverse(boost::optional< Matrix & > H1=boost::none) const
inverse transformation with derivatives
Definition: Pose3.cpp:282
static size_t Dim()
Manifold dimension.
Definition: PinholeCamera.h:258
Calibration & calibration()
return calibration
Definition: PinholeCamera.h:159
This is the interface class for any value that may be used as a variable assignment in a factor graph...
Definition: Value.h:81
size_t dim() const
Manifold dimension.
Definition: PinholeCamera.h:253
double range(const PinholeCamera< CalibrationB > &camera, boost::optional< Matrix & > Dpose=boost::none, boost::optional< Matrix & > Dother=boost::none) const
Calculate range to another camera.
Definition: PinholeCamera.h:473
Point3 unrotate(const Point3 &p, boost::optional< Matrix & > H1=boost::none, boost::optional< Matrix & > H2=boost::none) const
rotate point from world to rotated frame
Definition: Rot3.cpp:102
Matrix eye(size_t m, size_t n)
Creates an identity matrix, with matlab-like syntax.
Definition: Matrix.cpp:50
Point3 rotate(const Point3 &p, boost::optional< Matrix & > H1=boost::none, boost::optional< Matrix & > H2=boost::none) const
rotate point from rotated coordinate frame to world
Definition: Rot3M.cpp:174
Vector6 localCoordinates(const Pose3 &T2, Pose3::CoordinatesMode mode=POSE3_DEFAULT_COORDINATES_MODE) const
Local 6D coordinates of Pose3 manifold neighborhood around current pose.
Definition: Pose3.cpp:198
const Pose3 & pose() const
return pose
Definition: PinholeCamera.h:154
Point3 backprojectPointAtInfinity(const Point2 &p) const
backproject a 2-dimensional point to a 3-dimensional point at infinity
Definition: PinholeCamera.h:417
Definition: Point2.h:35
2D Pose
const Calibration & calibration() const
return calibration
Definition: PinholeCamera.h:164
Point2 project(const Point3 &pw, boost::optional< Matrix & > Dpose=boost::none, boost::optional< Matrix & > Dpoint=boost::none, boost::optional< Matrix & > Dcal=boost::none) const
project a point from world coordinate to the image
Definition: PinholeCamera.h:299
Point3 cross(const Point3 &q) const
cross product
Definition: Point3.cpp:86
Definition: Pose3.h:42
2D Point
static Point2 project_to_camera(const Point3 &P, boost::optional< Matrix & > Dpoint=boost::none)
projects a 3-dimensional point in camera coordinates into the camera and returns a 2-dimensional poin...
Definition: PinholeCamera.h:272
PinholeCamera(const Pose3 &pose)
constructor with pose
Definition: PinholeCamera.h:55
PinholeCamera()
default constructor
Definition: PinholeCamera.h:51
Definition: PinholeCamera.h:40
Definition: CalibratedCamera.h:42
bool equals(const Pose3 &pose, double tol=1e-9) const
assert equality up to a tolerance
Definition: Pose3.cpp:124
double z() const
get z
Definition: Point3.h:205
Definition: Rot3.h:61
Point3 transform_from(const Point3 &p, boost::optional< Matrix & > Dpose=boost::none, boost::optional< Matrix & > Dpoint=boost::none) const
takes point in Pose coordinates and transforms it to world coordinates
Definition: Pose3.cpp:243
Matrix3 matrix() const
return 3*3 rotation matrix
Definition: Rot3M.cpp:281
Definition: CalibratedCamera.h:27
Pose3 retract(const Vector &d, Pose3::CoordinatesMode mode=POSE3_DEFAULT_COORDINATES_MODE) const
Retraction from R^6 to Pose3 manifold neighborhood around current pose.
Definition: Pose3.cpp:181
double range(const CalibratedCamera &camera, boost::optional< Matrix & > Dpose=boost::none, boost::optional< Matrix & > Dother=boost::none) const
Calculate range to another camera.
Definition: PinholeCamera.h:502
double y() const
get y
Definition: Point3.h:202
double x() const
get x
Definition: Pose2.h:203
static PinholeCamera Level(const Calibration &K, const Pose2 &pose2, double height)
Create a level camera at the given 2D pose and height.
Definition: PinholeCamera.h:75
const PinholeCamera inverse(boost::optional< Matrix & > H1=boost::none) const
inverse camera: TODO Frank says this might not make sense
Definition: PinholeCamera.h:213
static PinholeCamera Level(const Pose2 &pose2, double height)
PinholeCamera::level with default calibration.
Definition: PinholeCamera.h:86
Point2 projectPointAtInfinity(const Point3 &pw, boost::optional< Matrix & > Dpose=boost::none, boost::optional< Matrix & > Dpoint=boost::none, boost::optional< Matrix & > Dcal=boost::none) const
project a point at infinity from world coordinate to the image
Definition: PinholeCamera.h:338
double y() const
get y
Definition: Point2.h:213
static PinholeCamera Lookat(const Point3 &eye, const Point3 &target, const Point3 &upVector, const Calibration &K=Calibration())
Create a camera at the given eye position looking at a target point in the scene with the specified u...
Definition: PinholeCamera.h:99
double y() const
get y
Definition: Pose2.h:206
double range(const Point3 &point, boost::optional< Matrix & > Dpose=boost::none, boost::optional< Matrix & > Dpoint=boost::none) const
Calculate range to a landmark.
Definition: PinholeCamera.h:430
const PinholeCamera between(const PinholeCamera &c, boost::optional< Matrix & > H1=boost::none, boost::optional< Matrix & > H2=boost::none) const
between two cameras: TODO Frank says this might not make sense
Definition: PinholeCamera.h:193
Point2 project2(const Point3 &pw, boost::optional< Matrix & > Dcamera=boost::none, boost::optional< Matrix & > Dpoint=boost::none) const
project a point from world coordinate to the image
Definition: PinholeCamera.h:379
typedef and functions to augment Eigen's MatrixXd
Definition: Pose2.h:36
3D Pose
Point3 transform_to(const Point3 &p, boost::optional< Matrix & > Dpose=boost::none, boost::optional< Matrix & > Dpoint=boost::none) const
takes point in world coordinates and transforms it to Pose coordinates
Definition: Pose3.cpp:257
Pose3 between(const Pose3 &p2, boost::optional< Matrix & > H1=boost::none, boost::optional< Matrix & > H2=boost::none) const
Return relative pose between p1 and p2, in p1 coordinate frame as well as optionally the derivatives...
Definition: Pose3.cpp:291
Calibrated camera for which only pose is unknown.
double x() const
get x
Definition: Point3.h:199
double x() const
get x
Definition: Point2.h:210
friend class boost::serialization::access
Serialization function.
Definition: PinholeCamera.h:560
bool equals(const PinholeCamera &camera, double tol=1e-9) const
assert equality up to a tolerance
Definition: PinholeCamera.h:130
static Pose3 Expmap(const Vector &xi)
Exponential map at identity - create a rotation from canonical coordinates .
Definition: Pose3.cpp:130
static size_t Dim()
Dimensionality of tangent space = 6 DOF - used to autodetect sizes.
Definition: Pose3.h:134
void print(const std::string &s="PinholeCamera") const
print
Definition: PinholeCamera.h:136
double theta() const
get theta
Definition: Pose2.h:209
Point3 backproject(const Point2 &p, double depth) const
backproject a 2-dimensional point to a 3-dimensional point at given depth
Definition: PinholeCamera.h:410
Vector localCoordinates(const PinholeCamera &T2) const
return canonical coordinate
Definition: PinholeCamera.h:244
Definition: DerivedValue.h:44
double range(const Pose3 &pose, boost::optional< Matrix & > Dpose=boost::none, boost::optional< Matrix & > Dpose2=boost::none) const
Calculate range to another pose.
Definition: PinholeCamera.h:451
PinholeCamera retract(const Vector &d) const
move a cameras according to d
Definition: PinholeCamera.h:235
const PinholeCamera compose(const PinholeCamera &c, boost::optional< Matrix & > H1=boost::none, boost::optional< Matrix & > H2=boost::none) const
compose two cameras: TODO Frank says this might not make sense
Definition: PinholeCamera.h:173
Pose3 & pose()
return pose
Definition: PinholeCamera.h:149
size_t dim() const
Dimensionality of the tangent space = 6 DOF.
Definition: Pose3.h:139
Definition: Point3.h:39
Matrix zeros(size_t m, size_t n)
Creates an zeros matrix, with matlab-like syntax.
Definition: Matrix.cpp:40