gtsam  4.1.0
gtsam
SimpleCamera.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 
23 #include <gtsam/geometry/Cal3_S2.h>
24 
25 namespace gtsam {
26 
29 
34 class GTSAM_EXPORT SimpleCamera : public PinholeCameraCal3_S2 {
35 
37  typedef boost::shared_ptr<SimpleCamera> shared_ptr;
38 
39 public:
40 
43 
46  Base() {
47  }
48 
50  explicit SimpleCamera(const Pose3& pose) :
51  Base(pose) {
52  }
53 
55  SimpleCamera(const Pose3& pose, const Cal3_S2& K) :
56  Base(pose, K) {
57  }
58 
62 
70  static SimpleCamera Level(const Cal3_S2 &K, const Pose2& pose2,
71  double height) {
72  return SimpleCamera(Base::LevelPose(pose2, height), K);
73  }
74 
76  static SimpleCamera Level(const Pose2& pose2, double height) {
77  return SimpleCamera::Level(Cal3_S2(), pose2, height);
78  }
79 
89  static SimpleCamera Lookat(const Point3& eye, const Point3& target,
90  const Point3& upVector, const Cal3_S2& K = Cal3_S2()) {
91  return SimpleCamera(Base::LookatPose(eye, target, upVector), K);
92  }
93 
97 
99  explicit SimpleCamera(const Vector &v) :
100  Base(v) {
101  }
102 
104  SimpleCamera(const Vector &v, const Vector &K) :
105  Base(v, K) {
106  }
107 
109  SimpleCamera::shared_ptr clone() const { return boost::make_shared<SimpleCamera>(*this); }
110 
111 
115 
117  SimpleCamera retract(const Vector& d) const {
118  if ((size_t) d.size() == 6)
119  return SimpleCamera(this->pose().retract(d), calibration());
120  else
121  return SimpleCamera(this->pose().retract(d.head(6)),
122  calibration().retract(d.tail(calibration().dim())));
123  }
124 
126 
127 };
128 
130 GTSAM_EXPORT SimpleCamera simpleCamera(const Matrix34& P);
131 
132 // manifold traits
133 template <>
134 struct traits<SimpleCamera> : public internal::Manifold<SimpleCamera> {};
135 
136 template <>
137 struct traits<const SimpleCamera> : public internal::Manifold<SimpleCamera> {};
138 
139 // range traits, used in RangeFactor
140 template <typename T>
141 struct Range<SimpleCamera, T> : HasRange<SimpleCamera, T, double> {};
142 
143 } // namespace gtsam
gtsam::HasRange
Definition: BearingRange.h:193
gtsam::PinholeCameraCal3_S2
gtsam::PinholeCamera< gtsam::Cal3_S2 > PinholeCameraCal3_S2
A simple camera class with a Cal3_S2 calibration.
Definition: SimpleCamera.h:28
gtsam::PinholeBaseK< Calibration >
BearingRange.h
Bearing-Range product.
PinholeCamera.h
Base class for all pinhole cameras.
gtsam::traits
A manifold defines a space in which there is a notion of a linear tangent space that can be centered ...
Definition: concepts.h:30
gtsam::SimpleCamera
Definition: SimpleCamera.h:34
gtsam::SimpleCamera::Level
static SimpleCamera Level(const Pose2 &pose2, double height)
PinholeCamera::level with default calibration.
Definition: SimpleCamera.h:76
gtsam::SimpleCamera::SimpleCamera
SimpleCamera(const Vector &v)
Init from vector, can be 6D (default calibration) or dim.
Definition: SimpleCamera.h:99
gtsam::Cal3_S2
Definition: Cal3_S2.h:33
gtsam::Pose2
Definition: Pose2.h:36
gtsam
Global functions in a separate testing namespace.
Definition: chartTesting.h:28
gtsam::SimpleCamera::SimpleCamera
SimpleCamera(const Vector &v, const Vector &K)
Init from Vector and calibration.
Definition: SimpleCamera.h:104
gtsam::SimpleCamera::SimpleCamera
SimpleCamera(const Pose3 &pose, const Cal3_S2 &K)
constructor with pose and calibration
Definition: SimpleCamera.h:55
gtsam::internal::Manifold
Both ManifoldTraits and Testable.
Definition: Manifold.h:120
gtsam::Range
Definition: BearingRange.h:39
gtsam::PinholeCamera
Definition: PinholeCamera.h:33
gtsam::Pose3
Definition: Pose3.h:37
gtsam::SimpleCamera::SimpleCamera
SimpleCamera(const Pose3 &pose)
constructor with pose
Definition: SimpleCamera.h:50
gtsam::SimpleCamera::SimpleCamera
SimpleCamera()
default constructor
Definition: SimpleCamera.h:45
gtsam::SimpleCamera::retract
SimpleCamera retract(const Vector &d) const
move a cameras according to d
Definition: SimpleCamera.h:117
gtsam::Point3
Vector3 Point3
As of GTSAM 4, in order to make GTSAM more lean, it is now possible to just typedef Point3 to Vector3...
Definition: Point3.h:35
gtsam::SimpleCamera::Level
static SimpleCamera Level(const Cal3_S2 &K, const Pose2 &pose2, double height)
Create a level camera at the given 2D pose and height.
Definition: SimpleCamera.h:70
Cal3_S2.h
The most common 5DOF 3D->2D calibration.
gtsam::simpleCamera
SimpleCamera simpleCamera(const Matrix34 &P)
Recover camera from 3*4 camera matrix.
Definition: SimpleCamera.cpp:24
gtsam::SimpleCamera::Lookat
static SimpleCamera Lookat(const Point3 &eye, const Point3 &target, const Point3 &upVector, const Cal3_S2 &K=Cal3_S2())
Create a camera at the given eye position looking at a target point in the scene with the specified u...
Definition: SimpleCamera.h:89
gtsam::SimpleCamera::clone
SimpleCamera::shared_ptr clone() const
Copy this object as its actual derived type.
Definition: SimpleCamera.h:109