32 template<
typename Calibration>
42 typedef Point2Vector MeasurementVector;
106 const Point3& upVector,
const Calibration& K = Calibration()) {
114 typedef Eigen::Matrix<double, DimK, 6> MatrixK6;
116 *H1 << I_6x6, MatrixK6::Zero();
117 typedef Eigen::Matrix<double, 6, DimK> Matrix6K;
118 typedef Eigen::Matrix<double, DimK, DimK> MatrixK;
120 *H2 << Matrix6K::Zero(), MatrixK::Identity();
132 K_ = Calibration(v.tail<DimK>());
146 const PinholeCamera* e = dynamic_cast<const PinholeCamera*>(&camera);
151 void print(
const std::string& s =
"PinholeCamera")
const {
153 K_.print(s +
".calibration");
172 H->template block<6, 6>(0, 0) = I_6x6;
196 typedef Eigen::Matrix<double, dimension, 1> VectorK6;
200 if ((
size_t) d.size() == 6)
224 typedef Eigen::Matrix<double, 2, DimK> Matrix2K;
229 template<
class POINT>
234 Eigen::Matrix<double, 2, DimK> Dcal;
236 Dcamera ? &Dcal : 0);
238 *Dcamera <<
Dpose, Dcal;
262 double result = this->
pose().
range(point, Dcamera ? &Dpose_ : 0,
Dpoint);
264 *Dcamera << Dpose_, Eigen::Matrix<double, 1, DimK>::Zero();
276 double result = this->
pose().
range(pose, Dcamera ? &Dpose_ : 0,
Dpose);
278 *Dcamera << Dpose_, Eigen::Matrix<double, 1, DimK>::Zero();
287 template<
class CalibrationB>
291 Matrix16 Dcamera_, Dother_;
292 double result = this->
pose().
range(camera.
pose(), Dcamera ? &Dcamera_ : 0,
293 Dother ? &Dother_ : 0);
295 *Dcamera << Dcamera_, Eigen::Matrix<double, 1, DimK>::Zero();
299 Dother->template block<1, 6>(0, 0) = Dother_;
312 return range(camera.
pose(), Dcamera, Dother);
319 template<
class Archive>
320 void serialize(Archive & ar,
const unsigned int ) {
322 & boost::serialization::make_nvp(
"PinholeBaseK",
323 boost::serialization::base_object<Base>(*
this));
324 ar & BOOST_SERIALIZATION_NVP(K_);
328 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
333 template <
typename Calibration>
337 template <
typename Calibration>
342 template <
typename Calibration,
typename T>
PinholeCamera(const Pose3 &pose)
constructor with pose
Definition: PinholeCamera.h:66
bool equals(const PinholeBase &camera, double tol=1e-9) const
assert equality up to a tolerance
Definition: CalibratedCamera.cpp:69
Both ManifoldTraits and Testable.
Definition: Manifold.h:120
Definition: PinholeCamera.h:33
void print(const std::string &s="PinholeBase") const
print
Definition: CalibratedCamera.cpp:74
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:105
bool equals(const Base &camera, double tol=1e-9) const
assert equality up to a tolerance
Definition: PinholeCamera.h:145
OptionalJacobian is an Eigen::Ref like class that can take be constructed using either a fixed size o...
Definition: OptionalJacobian.h:39
static PinholeCamera Level(const Pose2 &pose2, double height)
PinholeCamera::level with default calibration.
Definition: PinholeCamera.h:92
double range(const Point3 &point, OptionalJacobian< 1, 6 > H1=boost::none, OptionalJacobian< 1, 3 > H2=boost::none) const
Calculate range to a landmark.
Definition: Pose3.cpp:348
Definition: PinholePose.h:34
PinholeCamera retract(const Vector &d) const
move a cameras according to d
Definition: PinholeCamera.h:199
Give fixed size dimension of a type, fails at compile time if dynamic.
Definition: Manifold.h:164
static size_t Dim()
Definition: PinholeCamera.h:192
Point2 Measurement
Some classes template on either PinholeCamera or StereoCamera, and this typedef informs those classes...
Definition: PinholeCamera.h:41
static Matrix26 Dpose(const Point2 &pn, double d)
Calculate Jacobian with respect to pose.
Definition: CalibratedCamera.cpp:27
Definition: BearingRange.h:193
Pinhole camera with known calibration.
Represents a 3D point on a unit sphere.
Definition: Unit3.h:42
size_t dim() const
Definition: PinholeCamera.h:187
VectorK6 localCoordinates(const PinholeCamera &T2) const
return canonical coordinate
Definition: PinholeCamera.h:208
static Matrix23 Dpoint(const Point2 &pn, double d, const Matrix3 &Rt)
Calculate Jacobian with respect to point.
Definition: CalibratedCamera.cpp:37
Definition: CalibratedCamera.h:250
Class retract(const TangentVector &v) const
retract as required by manifold concept: applies v at *this
Definition: Lie.h:133
friend class boost::serialization::access
Serialization function.
Definition: PinholeCamera.h:318
Point2 project2(const Unit3 &pw, OptionalJacobian< 2, dimension > Dcamera=boost::none, OptionalJacobian< 2, 2 > Dpoint=boost::none) const
project a point at infinity from world coordinates into the image
Definition: PinholeCamera.h:249
A manifold defines a space in which there is a notion of a linear tangent space that can be centered ...
Definition: concepts.h:30
double range(const PinholeCamera< CalibrationB > &camera, OptionalJacobian< 1, dimension > Dcamera=boost::none, OptionalJacobian< 1, 6+CalibrationB::dimension > Dother=boost::none) const
Calculate range to another camera.
Definition: PinholeCamera.h:288
double range(const Pose3 &pose, OptionalJacobian< 1, dimension > Dcamera=boost::none, OptionalJacobian< 1, 6 > Dpose=boost::none) const
Calculate range to another pose.
Definition: PinholeCamera.h:273
Definition: BearingRange.h:39
double range(const Point3 &point, OptionalJacobian< 1, dimension > Dcamera=boost::none, OptionalJacobian< 1, 3 > Dpoint=boost::none) const
Calculate range to a landmark.
Definition: PinholeCamera.h:259
void print(const std::string &s="PinholeCamera") const
print
Definition: PinholeCamera.h:151
PinholeCamera(const Vector &v)
Init from vector, can be 6D (default calibration) or dim.
Definition: PinholeCamera.h:129
Global functions in a separate testing namespace.
Definition: chartTesting.h:28
static PinholeCamera identity()
for Canonical
Definition: PinholeCamera.h:216
static Pose3 LookatPose(const Point3 &eye, const Point3 &target, const Point3 &upVector)
Create a camera pose at the given eye position looking at a target point in the scene with the specif...
Definition: CalibratedCamera.cpp:58
const Calibration & calibration() const
return calibration
Definition: PinholeCamera.h:178
Point2 project(const Point3 &pw, OptionalJacobian< 2, 6 > Dpose=boost::none, OptionalJacobian< 2, 3 > Dpoint=boost::none, OptionalJacobian< 2, DimK > Dcal=boost::none) const
project a 3D point from world coordinates into the image
Definition: PinholePose.h:118
PinholeCamera(const Vector &v, const Vector &K)
Init from Vector and calibration.
Definition: PinholeCamera.h:136
static Pose3 LevelPose(const Pose2 &pose2, double height)
Create a level pose at the given 2D pose and height.
Definition: CalibratedCamera.cpp:49
PinholeCamera()
default constructor
Definition: PinholeCamera.h:62
const Pose3 & pose() const
return pose, constant version
Definition: CalibratedCamera.h:155
const Pose3 & getPose(OptionalJacobian< 6, dimension > H) const
return pose, with derivative
Definition: PinholeCamera.h:169
TangentVector localCoordinates(const Class &g) const
localCoordinates as required by manifold concept: finds tangent vector between *this and g
Definition: Lie.h:138
Point2 project2(const Point3 &pw, OptionalJacobian< 2, dimension > Dcamera=boost::none, OptionalJacobian< 2, 3 > Dpoint=boost::none) const
project a 3D point from world coordinates into the image
Definition: PinholeCamera.h:243
PinholeCamera(const Pose3 &pose, const Calibration &K)
constructor with pose and calibration
Definition: PinholeCamera.h:71
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:86
const Pose3 & pose() const
return pose
Definition: PinholeCamera.h:164
double range(const CalibratedCamera &camera, OptionalJacobian< 1, dimension > Dcamera=boost::none, OptionalJacobian< 1, 6 > Dother=boost::none) const
Calculate range to a calibrated camera.
Definition: PinholeCamera.h:309
Point2 _project2(const POINT &pw, OptionalJacobian< 2, dimension > Dcamera, OptionalJacobian< 2, FixedDimension< POINT >::value > Dpoint) const
Templated projection of a 3D point or a point at infinity into the image.
Definition: PinholeCamera.h:230