69 template <
class CALIBRATION>
72 std::shared_ptr<CALIBRATION>
K)
87 const std::string&
s =
"",
90 std::cout <<
" EssentialMatrixFactor with measurements\n (" 91 << vA_.transpose() <<
")' and (" << vB_.transpose() <<
")'" 99 error << E.
error(vA_, vB_, H);
135 : Base(model, key1, key2),
150 template <
class CALIBRATION>
153 std::shared_ptr<CALIBRATION>
K)
154 : Base(model, key1, key2),
156 pn_(K->calibrate(pB)) {
157 f_ = 0.5 * (K->fx() + K->fy());
168 const std::string&
s =
"",
171 std::cout <<
" EssentialMatrixFactor2 with measurements\n (" 172 << dP1_.transpose() <<
")' and (" << pn_.transpose() <<
")'" 204 Matrix D_1T2_dir, DdP2_rot, DP2_point;
215 DdP2_E << DdP2_rot, -DP2_point * d * D_1T2_dir;
216 *DE = f_ * Dpn_dP2 * DdP2_E;
221 *Dd = -f_ * (Dpn_dP2 * (DP2_point * _1T2));
223 Point2 reprojectionError = pn - pn_;
224 return f_ * reprojectionError;
270 template <
class CALIBRATION>
273 std::shared_ptr<CALIBRATION>
K)
284 const std::string&
s =
"",
287 std::cout <<
" EssentialMatrixFactor3 with rotation " << cRb_ << std::endl;
305 Matrix D_e_cameraE, D_cameraE_E;
310 *DE = D_e_cameraE * D_cameraE_E;
333 template <
class CALIBRATION>
361 : Base(model, keyE, keyK), pA_(pA), pB_(pB) {}
371 const std::string&
s =
"",
374 std::cout <<
" EssentialMatrixFactor4 with measurements\n (" 375 << pA_.transpose() <<
")' and (" << pB_.transpose() <<
")'" 392 JacobianCalibration cA_H_K;
393 JacobianCalibration cB_H_K;
408 *H2 = vB.transpose() * E.
matrix().transpose().leftCols<2>() * cA_H_K +
409 vA.transpose() * E.
matrix().leftCols<2>() * cB_H_K;
413 error << E.
error(vA, vB, H1);
EssentialMatrixFactor2 This
gtsam::NonlinearFactor::shared_ptr clone() const override
void print(const std::string &s="", const KeyFormatter &keyFormatter=DefaultKeyFormatter) const override
print
noiseModel::Diagonal::shared_ptr model
const Unit3 & direction() const
Direction.
GTSAM_EXPORT double error(const Vector3 &vA, const Vector3 &vB, OptionalJacobian< 1, 5 > H={}) const
epipolar error, algebraic
virtual Vector evaluateError(const ValueTypes &... x, OptionalMatrixTypeT< ValueTypes >... H) const=0
Give fixed size dimension of a type, fails at compile time if dynamic.
static Cal3_S2 K(500, 500, 0.1, 640/2, 480/2)
Vector evaluateError(const EssentialMatrix &E, const double &d, OptionalMatrixType DE, OptionalMatrixType Dd) const override
EssentialMatrixFactor4 This
EssentialMatrixFactor3(Key key1, Key key2, const Point2 &pA, const Point2 &pB, const Rot3 &cRb, const SharedNoiseModel &model, std::shared_ptr< CALIBRATION > K)
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
static const KeyFormatter DefaultKeyFormatter
Rot3 is a 3D rotation represented as a rotation matrix if the preprocessor symbol GTSAM_USE_QUATERNIO...
Vector evaluateError(const EssentialMatrix &E, const CALIBRATION &K, OptionalMatrixType H1, OptionalMatrixType H2) const override
Calculate the algebraic epipolar error pA' (K^-1)' E K pB.
Vector3 vB_
Homogeneous versions, in ideal coordinates.
static Vector3 Homogeneous(const Point2 &p)
Static function to convert Point2 to homogeneous coordinates.
NoiseModelFactorN< EssentialMatrix, double > Base
void print(const std::string &s="", const KeyFormatter &keyFormatter=DefaultKeyFormatter) const override
Base class for all pinhole cameras.
Vector evaluateError(const EssentialMatrix &E, const double &d, OptionalMatrixType DE, OptionalMatrixType Dd) const override
gtsam::NonlinearFactor::shared_ptr clone() const override
EssentialMatrixFactor(Key key, const Point2 &pA, const Point2 &pB, const SharedNoiseModel &model, std::shared_ptr< CALIBRATION > K)
Matrix * OptionalMatrixType
Point3 unrotate(const Point3 &p, OptionalJacobian< 3, 3 > H1={}, OptionalJacobian< 3, 3 > H2={}) const
rotate point from world to rotated frame
void print(const std::string &s="", const KeyFormatter &keyFormatter=DefaultKeyFormatter) const override
print
EssentialMatrixFactor(Key key, const Point2 &pA, const Point2 &pB, const SharedNoiseModel &model)
Point2 pn_
Measurement in image 2, in ideal coordinates.
Point3 dP1_
3D point corresponding to measurement in image 1
gtsam::NonlinearFactor::shared_ptr clone() const override
NoiseModelFactorN< EssentialMatrix > Base
EssentialMatrixFactor This
void print(const std::string &s="", const KeyFormatter &keyFormatter=DefaultKeyFormatter) const override
print
EssentialMatrixFactor2(Key key1, Key key2, const Point2 &pA, const Point2 &pB, const SharedNoiseModel &model, std::shared_ptr< CALIBRATION > K)
Eigen::Matrix< double, 2, DimK > JacobianCalibration
static Point2 Project(const Point3 &pc, OptionalJacobian< 2, 3 > Dpoint={})
GTSAM_EXPORT EssentialMatrix rotate(const Rot3 &cRb, OptionalJacobian< 5, 5 > HE={}, OptionalJacobian< 5, 3 > HR={}) const
const Rot3 & rotation() const
Rotation.
Array< double, 1, 3 > e(1./3., 0.5, 2.)
std::function< std::string(Key)> KeyFormatter
Typedef for a function to format a key, i.e. to convert it to a string.
EssentialMatrixFactor3(Key key1, Key key2, const Point2 &pA, const Point2 &pB, const Rot3 &cRb, const SharedNoiseModel &model)
EssentialMatrixFactor2 Base
Point2 pB_
points in pixel coordinates
EssentialMatrixFactor4(Key keyE, Key keyK, const Point2 &pA, const Point2 &pB, const SharedNoiseModel &model)
double error(const Values &c) const override
Non-linear factor base classes.
NoiseModelFactorN< EssentialMatrix, CALIBRATION > Base
const Matrix3 & matrix() const
Return 3*3 matrix representation.
std::shared_ptr< This > shared_ptr
gtsam::NonlinearFactor::shared_ptr clone() const override
Vector evaluateError(const EssentialMatrix &E, OptionalMatrixType H) const override
vector of errors returns 1D vector
#define GTSAM_MAKE_ALIGNED_OPERATOR_NEW
Point3 point3(OptionalJacobian< 3, 2 > H={}) const
Return unit-norm Point3.
The matrix class, also used for vectors and row-vectors.
void print(const std::string &s="", const KeyFormatter &keyFormatter=DefaultKeyFormatter) const override
print
Rot3 cRb_
Rotation from body to camera frame.
double f_
approximate conversion factor for error scaling
std::uint64_t Key
Integer nonlinear key type.
EssentialMatrixFactor3 This
noiseModel::Base::shared_ptr SharedNoiseModel
EssentialMatrixFactor2(Key key1, Key key2, const Point2 &pA, const Point2 &pB, const SharedNoiseModel &model)