32 template<
typename Calibration>
106 const Point3& upVector,
const Calibration&
K = Calibration()) {
116 *H1 << I_6x6, MatrixK6::Zero();
120 *H2 << Matrix6K::Zero(), MatrixK::Identity();
132 K_ = Calibration(v.tail<DimK>());
151 void print(
const std::string&
s =
"PinholeCamera")
const override {
153 K_.print(
s +
".calibration");
172 H->template block<6, 6>(0, 0) = I_6x6;
200 if ((
size_t) d.size() == 6)
229 template<
class POINT>
237 *Dcamera <<
Dpose, Dcal;
264 double result = this->
pose().
range(point, Dcamera ? &Dpose_ : 0, Dpoint);
266 *Dcamera << Dpose_, Eigen::Matrix<double, 1, DimK>::Zero();
278 double result = this->
pose().
range(pose, Dcamera ? &Dpose_ : 0, Dpose);
280 *Dcamera << Dpose_, Eigen::Matrix<double, 1, DimK>::Zero();
289 template<
class CalibrationB>
293 Matrix16 Dcamera_, Dother_;
295 Dother ? &Dother_ : 0);
297 *Dcamera << Dcamera_, Eigen::Matrix<double, 1, DimK>::Zero();
301 Dother->template block<1, 6>(0, 0) = Dother_;
314 return range(camera.
pose(), Dcamera, Dother);
329 #ifdef GTSAM_ENABLE_BOOST_SERIALIZATION 331 friend class boost::serialization::access;
332 template<
class Archive>
333 void serialize(Archive & ar,
const unsigned int ) {
335 & boost::serialization::make_nvp(
"PinholeBaseK",
336 boost::serialization::base_object<Base>(*
this));
337 ar & BOOST_SERIALIZATION_NVP(K_);
347 template <
typename Calibration>
351 template <
typename Calibration>
356 template <
typename Calibration,
typename T>
Pinhole camera with known calibration.
static PinholeCamera Level(const Calibration &K, const Pose2 &pose2, double height)
double range(const PinholeCamera< CalibrationB > &camera, OptionalJacobian< 1, dimension > Dcamera={}, OptionalJacobian< 1, 6+CalibrationB::dimension > Dother={}) const
Both ManifoldTraits and Testable.
static PinholeCamera Lookat(const Point3 &eye, const Point3 &target, const Point3 &upVector, const Calibration &K=Calibration())
std::string serialize(const T &input)
serializes to a string
Matrix34 cameraProjectionMatrix() const
for Linear Triangulation
PinholeBaseK< Calibration > Base
base class has 3D pose as private member
Eigen::Matrix< double, dimension, 1 > VectorK6
PinholeCamera(const Pose3 &pose, const Calibration &K)
Point2 _project2(const POINT &pw, OptionalJacobian< 2, dimension > Dcamera, OptionalJacobian< 2, FixedDimension< POINT >::value > Dpoint) const
Give fixed size dimension of a type, fails at compile time if dynamic.
static Pose3 LookatPose(const Point3 &eye, const Point3 &target, const Point3 &upVector)
static Pose3 LevelPose(const Pose2 &pose2, double height)
static Cal3_S2 K(500, 500, 0.1, 640/2, 480/2)
static const Pose3 T2(Rot3::Rodrigues(0.3, 0.2, 0.1), P2)
set noclip points set clip one set noclip two set bar set border lt lw set xdata set ydata set zdata set x2data set y2data set boxwidth set dummy y set format x g set format y g set format x2 g set format y2 g set format z g set angles radians set nogrid set key title set key left top Right noreverse box linetype linewidth samplen spacing width set nolabel set noarrow set nologscale set logscale x set set pointsize set encoding default set nopolar set noparametric set set set set surface set nocontour set clabel set mapping cartesian set nohidden3d set cntrparam order set cntrparam linear set cntrparam levels auto set cntrparam points set size set set xzeroaxis lt lw set x2zeroaxis lt lw set yzeroaxis lt lw set y2zeroaxis lt lw set tics in set ticslevel set tics set mxtics default set mytics default set mx2tics default set my2tics default set xtics border mirror norotate autofreq set ytics border mirror norotate autofreq set ztics border nomirror norotate autofreq set nox2tics set noy2tics set timestamp bottom norotate set rrange [*:*] noreverse nowriteback set trange [*:*] noreverse nowriteback set urange [*:*] noreverse nowriteback set vrange [*:*] noreverse nowriteback set xlabel matrix size set x2label set timefmt d m y n H
const Calibration & calibration() const override
return calibration
static PinholeCamera Identity()
for Canonical
Pose3 inverse() const
inverse transformation with derivatives
Point2 project2(const Unit3 &pw, OptionalJacobian< 2, dimension > Dcamera={}, OptionalJacobian< 2, 2 > Dpoint={}) const
project a point at infinity from world coordinates into the image
const Pose3 & pose() const
return pose
Eigen::Matrix< double, 2, DimK > Matrix2K
TangentVector localCoordinates(const Class &g) const
localCoordinates as required by manifold concept: finds tangent vector between *this and g ...
virtual void print(const std::string &s="PinholeBase") const
print
Represents a 3D point on a unit sphere.
Point2 project(const Point3 &pw, OptionalJacobian< 2, 6 > Dpose={}, OptionalJacobian< 2, 3 > Dpoint={}, OptionalJacobian< 2, DimK > Dcal={}) const
project a 3D point from world coordinates into the image
PinholeCamera(const Vector &v)
Init from vector, can be 6D (default calibration) or dim.
const Pose3 & pose() const
return pose, constant version
PinholeCamera(const Pose3 &pose)
~PinholeCamera() override
Array< int, Dynamic, 1 > v
Vector defaultErrorWhenTriangulatingBehindCamera() const
for Nonlinear Triangulation
Array< double, 1, 3 > e(1./3., 0.5, 2.)
static Matrix23 Dpoint(const Point2 &pn, double d, const Matrix3 &Rt)
bool equals(const Base &camera, double tol=1e-9) const
assert equality up to a tolerance
static Matrix26 Dpose(const Point2 &pn, double d)
const Pose3 & getPose(OptionalJacobian< 6, dimension > H) const
return pose, with derivative
PinholeCamera retract(const Vector &d) const
move a cameras according to d
Class retract(const TangentVector &v) const
retract as required by manifold concept: applies v at *this
double range(const CalibratedCamera &camera, OptionalJacobian< 1, dimension > Dcamera={}, OptionalJacobian< 1, 6 > Dother={}) const
static PinholeCamera Create(const Pose3 &pose, const Calibration &K, OptionalJacobian< dimension, 6 > H1={}, OptionalJacobian< dimension, DimK > H2={})
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE FixedSegmentReturnType< internal::get_fixed_value< NType >::value >::Type head(NType n)
std::vector< Point2, Eigen::aligned_allocator< Point2 > > Point2Vector
Calibration K_
Calibration, part of class now.
VectorK6 localCoordinates(const PinholeCamera &T2) const
return canonical coordinate
double range(const Pose3 &pose, OptionalJacobian< 1, dimension > Dcamera={}, OptionalJacobian< 1, 6 > Dpose={}) const
Point2Vector MeasurementVector
#define GTSAM_MAKE_ALIGNED_OPERATOR_NEW
Point2 project2(const Point3 &pw, OptionalJacobian< 2, dimension > Dcamera={}, OptionalJacobian< 2, 3 > Dpoint={}) const
project a 3D point from world coordinates into the image
The matrix class, also used for vectors and row-vectors.
static const CalibratedCamera camera(kDefaultPose)
static PinholeCamera Level(const Pose2 &pose2, double height)
PinholeCamera::level with default calibration.
PinholeCamera(const Vector &v, const Vector &K)
Init from Vector and calibration.
double range(const Point3 &point, OptionalJacobian< 1, dimension > Dcamera={}, OptionalJacobian< 1, 3 > Dpoint={}) const
bool equals(const PinholeBase &camera, double tol=1e-9) const
assert equality up to a tolerance
double range(const Point3 &point, OptionalJacobian< 1, 6 > Hself={}, OptionalJacobian< 1, 3 > Hpoint={}) const
void print(const std::string &s="PinholeCamera") const override
print