32 template<
typename CALIBRATION>
89 template <
class POINT>
100 Dpose ||
Dpoint ? &Dpi_pn : 0);
104 *Dpose = Dpi_pn * *
Dpose;
142 Dresult_dp ? &Dpn_dp : 0);
144 Matrix31 Dpoint_ddepth;
146 (Dresult_dp || Dresult_dcal) ? &Dpoint_dpn : 0,
147 Dresult_ddepth ? &Dpoint_ddepth : 0);
148 Matrix33 Dresult_dpoint;
152 Dresult_dcal) ? &Dresult_dpoint : 0);
154 *Dresult_dcal = Dresult_dpoint * Dpoint_dpn * Dpn_dcal;
156 *Dresult_dp = Dresult_dpoint * Dpoint_dpn * Dpn_dp;
158 *Dresult_ddepth = Dresult_dpoint * Dpoint_ddepth;
166 const Unit3 pc(pn.x(), pn.y(), 1.0);
178 return pose().
range(point, Dcamera, Dpoint);
188 return this->
pose().
range(pose, Dcamera, Dpose);
206 template<
class CalibrationB>
215 #ifdef GTSAM_ENABLE_BOOST_SERIALIZATION 217 friend class boost::serialization::access;
218 template<
class Archive>
219 void serialize(Archive & ar,
const unsigned int ) {
221 & boost::serialization::make_nvp(
"PinholeBase",
222 boost::serialization::base_object<PinholeBase>(*
this));
238 template<
typename CALIBRATION>
244 std::shared_ptr<CALIBRATION>
K_;
261 Base(pose), K_(new CALIBRATION()) {
282 return PinholePose(Base::LevelPose(pose2, height), K);
300 const Point3& upVector,
const std::shared_ptr<CALIBRATION>&
K =
301 std::make_shared<CALIBRATION>()) {
302 return PinholePose(Base::LookatPose(eye, target, upVector),
K);
311 Base(v), K_(new CALIBRATION()) {
316 Base(v), K_(new CALIBRATION(K)) {
321 Base(pose), K_(new CALIBRATION(K)) {
338 if (!camera.
K_) os <<
", K: none";
339 else os <<
", K: " << *camera.
K_;
345 void print(
const std::string&
s =
"PinholePose")
const override {
348 std::cout <<
"s No calibration given" << std::endl;
350 K_->print(
s +
".calibration");
407 return Base::pose().localCoordinates(p.Base::pose());
429 #ifdef GTSAM_ENABLE_BOOST_SERIALIZATION 431 friend class boost::serialization::access;
432 template<
class Archive>
433 void serialize(Archive & ar,
const unsigned int ) {
435 & boost::serialization::make_nvp(
"PinholeBaseK",
436 boost::serialization::base_object<Base>(*
this));
437 ar & BOOST_SERIALIZATION_NVP(K_);
446 template<
typename CALIBRATION>
448 PinholePose<CALIBRATION> > {
451 template<
typename CALIBRATION>
453 PinholePose<CALIBRATION> > {
const CALIBRATION & calibration() const override
return calibration
Both ManifoldTraits and Testable.
static Point2 project(const Pose3 &pose, const Unit3 &pointAtInfinity, const Cal3_S2::shared_ptr &cal)
Point2 _project(const POINT &pw, OptionalJacobian< 2, 6 > Dpose, OptionalJacobian< 2, FixedDimension< POINT >::value > Dpoint, OptionalJacobian< 2, DimK > Dcal) const
const Point3 & translation(OptionalJacobian< 3, 6 > Hself={}) const
get translation
m m block(1, 0, 2, 2)<< 4
static Point3 BackprojectFromCamera(const Point2 &p, const double depth, OptionalJacobian< 3, 2 > Dpoint={}, OptionalJacobian< 3, 1 > Ddepth={})
backproject a 2-dimensional point to a 3-dimensional point at given depth
std::string serialize(const T &input)
serializes to a string
Point2 project(const Unit3 &pw, OptionalJacobian< 2, 6 > Dpose={}, OptionalJacobian< 2, 2 > Dpoint={}, OptionalJacobian< 2, DimK > Dcal={}) const
project a point at infinity from world coordinates into the image
Matrix34 cameraProjectionMatrix() const
for Linear Triangulation
Point3 backproject(const Point2 &p, double depth, OptionalJacobian< 3, 6 > Dresult_dpose={}, OptionalJacobian< 3, 2 > Dresult_dp={}, OptionalJacobian< 3, 1 > Dresult_ddepth={}, OptionalJacobian< 3, DimK > Dresult_dcal={}) const
backproject a 2-dimensional point to a 3-dimensional point at given depth
int RealScalar int RealScalar int RealScalar * pc
double range(const Point3 &point, OptionalJacobian< 1, 6 > Dcamera={}, OptionalJacobian< 1, 3 > Dpoint={}) const
PinholePose(const Vector &v, const Vector &K)
Init from Vector and calibration.
PinholePose(const Pose3 &pose, const std::shared_ptr< CALIBRATION > &K)
static PinholePose Level(const Pose2 &pose2, double height)
PinholePose::level with default calibration.
Give fixed size dimension of a type, fails at compile time if dynamic.
static PinholePose Identity()
for Canonical
PinholePose(const Pose3 &pose)
virtual const CALIBRATION & calibration() const =0
return calibration
static Cal3_S2 K(500, 500, 0.1, 640/2, 480/2)
bool equals(const Base &camera, double tol=1e-9) const
assert equality up to a tolerance
EIGEN_STRONG_INLINE Packet4f print(const Packet4f &a)
Unit3 backprojectPointAtInfinity(const Point2 &p) const
backproject a 2-dimensional point to a 3-dimensional point at infinity
std::pair< Point2, bool > projectSafe(const Point3 &pw) const
Project a point into the image and check depth.
void print(const std::string &s="PinholePose") const override
print
EIGEN_DEVICE_FUNC const InverseReturnType inverse() const
PinholePose retract(const Vector6 &d) const
move a cameras according to d
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
Point2 project2(const Unit3 &pw, OptionalJacobian< 2, 6 > Dpose={}, OptionalJacobian< 2, 2 > Dpoint={}) const
project2 version for point at infinity
const Pose3 & pose() const
return pose, constant version
std::shared_ptr< CALIBRATION > K_
shared pointer to fixed calibration
Array< int, Dynamic, 1 > v
Vector defaultErrorWhenTriangulatingBehindCamera() const
for Nonlinear Triangulation
Point3 transformFrom(const Point3 &point, OptionalJacobian< 3, 6 > Hself={}, OptionalJacobian< 3, 3 > Hpoint={}) const
takes point in Pose coordinates and transforms it to world coordinates
Vector3 rpy(OptionalJacobian< 3, 3 > H={}) const
Array< double, 1, 3 > e(1./3., 0.5, 2.)
static Matrix23 Dpoint(const Point2 &pn, double d, const Matrix3 &Rt)
double range(const PinholeBaseK< CalibrationB > &camera, OptionalJacobian< 1, 6 > Dcamera={}, OptionalJacobian< 1, 6 > Dother={}) const
PinholeBaseK(const Pose3 &pose)
static Matrix26 Dpose(const Point2 &pn, double d)
static PinholePose Lookat(const Point3 &eye, const Point3 &target, const Point3 &upVector, const std::shared_ptr< CALIBRATION > &K=std::make_shared< CALIBRATION >())
PinholePose(const Vector &v)
Init from 6D vector.
Calibrated camera for which only pose is unknown.
PinholeBaseK< CALIBRATION > Base
base class has 3D pose as private member
Point2 reprojectionError(const Point3 &pw, const Point2 &measured, OptionalJacobian< 2, 6 > Dpose={}, OptionalJacobian< 2, 3 > Dpoint={}, OptionalJacobian< 2, DimK > Dcal={}) const
project a 3D point from world coordinates into the image
static PinholePose Level(const std::shared_ptr< CALIBRATION > &K, const Pose2 &pose2, double height)
static const Pose3 pose(Rot3(Vector3(1, -1, -1).asDiagonal()), Point3(0, 0, 0.5))
Calibration used by Bundler.
ofstream os("timeSchurFactors.csv")
friend std::ostream & operator<<(std::ostream &os, const PinholePose &camera)
stream operator
Point2 project2(const Point3 &point, OptionalJacobian< 2, 6 > Dpose={}, OptionalJacobian< 2, 3 > Dpoint={}) const
PinholePose(const Pose3 &pose, const Vector &K)
Point2 project2(const Point3 &pw, OptionalJacobian< 2, 6 > Dpose={}, OptionalJacobian< 2, 3 > Dpoint={}) const
double range(const CalibratedCamera &camera, OptionalJacobian< 1, 6 > Dcamera={}, OptionalJacobian< 1, 6 > Dother={}) const
#define GTSAM_CONCEPT_MANIFOLD_TYPE(T)
const Rot3 & rotation(OptionalJacobian< 3, 6 > Hself={}) const
get rotation
#define GTSAM_MAKE_ALIGNED_OPERATOR_NEW
Point3 rotate(const Point3 &p, OptionalJacobian< 3, 3 > H1={}, OptionalJacobian< 3, 3 > H2={}) const
Map< Matrix< T, Dynamic, Dynamic, ColMajor >, 0, OuterStride<> > matrix(T *data, int rows, int cols, int stride)
The matrix class, also used for vectors and row-vectors.
static const CalibratedCamera camera(kDefaultPose)
PinholeBaseK(const Vector &v)
std::pair< Point2, bool > projectSafe(const Point3 &pw) const
Project a point into the image and check depth.
Vector6 localCoordinates(const PinholePose &p) const
return canonical coordinate
const std::shared_ptr< CALIBRATION > & sharedCalibration() const
return shared pointer to calibration
double range(const Pose3 &pose, OptionalJacobian< 1, 6 > Dcamera={}, OptionalJacobian< 1, 6 > Dpose={}) const
double range(const Point3 &point, OptionalJacobian< 1, 6 > Hself={}, OptionalJacobian< 1, 3 > Hpoint={}) const