31 #include <boost/bind.hpp> 34 using namespace gtsam;
37 static double fov = 60;
38 static size_t w=640,
h=480;
60 TestProjectionFactor factor(measurement,
model,
X(1),
T(1),
L(1),
K(1));
79 TestProjectionFactor factor(measurement,
model,
X(1),
T(1),
L(1),
K(1));
100 TestProjectionFactor factor(measurement,
model,
X(1),
T(1),
L(1),
K(1));
120 TestProjectionFactor factor(measurement,
model,
X(1),
T(1),
L(1),
K(1));
127 Matrix H1Actual, H2Actual, H3Actual, H4Actual;
131 Matrix H1Expected = (
Matrix(2, 6) << 0., -554.256, 0., -92.376, 0., 0., 554.256, 0., 0., 0., -92.376, 0.).finished();
132 Matrix H3Expected = (
Matrix(2, 3) << 92.376, 0., 0., 0., 92.376, 0.).finished();
139 Matrix H2Expected = numericalDerivative11<Vector, Pose3>(
141 *
K1, boost::none, boost::none, boost::none, boost::none),
Pose3());
143 Matrix H4Expected = numericalDerivative11<Vector, Cal3_S2>(
145 _1, boost::none, boost::none, boost::none, boost::none), *
K1);
155 Pose3 body_P_sensor(Rot3::RzRyRx(-M_PI_2, 0.0, -M_PI_2),
Point3(0.25, -0.10, 1.0));
156 TestProjectionFactor factor(measurement,
model,
X(1),
T(1),
L(1),
K(1));
163 Matrix H1Actual, H2Actual, H3Actual, H4Actual;
164 factor.
evaluateError(pose, body_P_sensor, point, *
K1, H1Actual, H2Actual, H3Actual, H4Actual);
167 Matrix H1Expected = (
Matrix(2, 6) << -92.376, 0., 577.350, 0., 92.376, 0., -9.2376, -577.350, 0., 0., 0., 92.376).finished();
168 Matrix H3Expected = (
Matrix(2, 3) << 0., -92.376, 0., 0., 0., -92.376).finished();
175 Matrix H2Expected = numericalDerivative11<Vector, Pose3>(
177 *
K1, boost::none, boost::none, boost::none, boost::none), body_P_sensor);
179 Matrix H4Expected = numericalDerivative11<Vector, Cal3_S2>(
181 _1, boost::none, boost::none, boost::none, boost::none), *
K1);
Provides additional testing facilities for common data structures.
static SharedNoiseModel model(noiseModel::Unit::Create(2))
static int runAllTests(TestResult &result)
static Cal3_S2 K(500, 500, 0.1, 640/2, 480/2)
Derived from ProjectionFactor, but estimates body-camera transform and calibration in addition to bod...
Calibration of a camera with radial distortion, calculations in base class Cal3DS2_Base.
Some functions to compute numerical derivatives.
ProjectionFactorPPPC< Pose3, Point3, Cal3_S2 > TestProjectionFactor
static const Pose3 pose(Rot3(Vector3(1,-1,-1).asDiagonal()), Point3(0, 0, 0.5))
Eigen::Triplet< double > T
Point2(* f)(const Point3 &, OptionalJacobian< 2, 3 >)
Array< double, 1, 3 > e(1./3., 0.5, 2.)
static Cal3_S2::shared_ptr K1(new Cal3_S2(fov, w, h))
EIGEN_DONT_INLINE void transform(const Transformation &t, Data &data)
Vector evaluateError(const Pose3 &pose, const Point3 &point, boost::optional< Matrix & > H1=boost::none, boost::optional< Matrix & > H2=boost::none) const override
Evaluate error h(x)-z and optionally derivatives.
bool assert_equal(const Matrix &expected, const Matrix &actual, double tol)
JacobianFactor factor2(keyX, A21, keyY, A22, b2, noiseModel::Isotropic::Sigma(2, sigma2))
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor > Matrix
TEST(ProjectionFactorPPPC, nonStandard)
boost::shared_ptr< Cal3_S2 > shared_ptr
noiseModel::Base::shared_ptr SharedNoiseModel
The most common 5DOF 3D->2D calibration.
JacobianFactor factor1(keyX, A11, b1, noiseModel::Isotropic::Sigma(2, sigma1))