18 using namespace gtsam;
33 Vector5 inv_landmark((
Vector(5) << 1., 0., 1., 0., 0.).finished());
34 double inv_depth(1./4);
35 Point2 actual_uv = inv_camera.
project(inv_landmark, inv_depth);
49 Vector5 diag_landmark((
Vector(5) << 0., 0., 1.,
M_PI/4.,
atan(1.0/
sqrt(2.0))).finished());
50 double inv_depth(1/
sqrt(3.0));
56 TEST( InvDepthFactor, Project3) {
64 Vector5 diag_landmark((
Vector(5) << 0., 0., 0.,
M_PI/4.,
atan(2./
sqrt(2.0))).finished());
65 double inv_depth( 1./
sqrt(1.0+1+4));
71 TEST( InvDepthFactor, Project4) {
79 Vector5 diag_landmark((
Vector(5) << 0., 0., 0.,
atan(4.0/1),
atan(2./
sqrt(1.+16.))).finished());
80 double inv_depth(1./
sqrt(1.+16.+4.));
90 TEST( InvDepthFactor, Dproject_pose)
93 double inv_depth(1./4);
97 inv_camera.
project(landmark, inv_depth, actual, {}, {});
102 TEST( InvDepthFactor, Dproject_landmark)
105 double inv_depth(1./4);
109 inv_camera.
project(landmark, inv_depth, {}, actual, {});
114 TEST( InvDepthFactor, Dproject_inv_depth)
117 double inv_depth(1./4);
121 inv_camera.
project(landmark, inv_depth, {}, {}, actual);
129 double inv_depth(1./4);
133 const auto [actual_vec, actual_inv] = inv_camera.
backproject(z, 4);
139 TEST(InvDepthFactor, backproject2)
143 double inv_depth(1./10);
147 const auto [actual_vec, actual_inv] = inv_camera.
backproject(z, 10);
TEST(InvDepthFactor, Project1)
static Cal3_S2::shared_ptr K(new Cal3_S2(1500, 1200, 0, 640, 480))
static Point2 project(const Pose3 &pose, const Unit3 &pointAtInfinity, const Cal3_S2::shared_ptr &cal)
Concept check for values that can be used in unit tests.
static int runAllTests(TestResult &result)
bool assert_equal(const Matrix &expected, const Matrix &actual, double tol)
Some functions to compute numerical derivatives.
#define EXPECT_DOUBLES_EQUAL(expected, actual, threshold)
static Point3 backproject(const Pose3 &pose, const Point2 &point, const double &depth)
PinholeCamera< Cal3_S2 > level_camera(level_pose, *K)
static Point3 landmark(0, 0, 5)
EIGEN_DEVICE_FUNC const AtanReturnType atan() const
Base class for all pinhole cameras.
internal::FixedSizeMatrix< Y, X3 >::type numericalDerivative33(std::function< Y(const X1 &, const X2 &, const X3 &)> h, const X1 &x1, const X2 &x2, const X3 &x3, double delta=1e-5)
static Point2 Project2(const Unit3 &point)
std::shared_ptr< Cal3_S2 > shared_ptr
Point2 project_(const Pose3 &pose, const Vector5 &landmark, const double &inv_depth)
std::pair< Vector5, double > backproject(const gtsam::Point2 &pi, const double depth) const
internal::FixedSizeMatrix< Y, X2 >::type numericalDerivative32(std::function< Y(const X1 &, const X2 &, const X3 &)> h, const X1 &x1, const X2 &x2, const X3 &x3, double delta=1e-5)
#define EXPECT(condition)
internal::FixedSizeMatrix< Y, X1 >::type numericalDerivative31(std::function< Y(const X1 &, const X2 &, const X3 &)> h, const X1 &x1, const X2 &x2, const X3 &x3, double delta=1e-5)
Inverse Depth Camera based on Civera09tro, Montiel06rss. Landmarks are initialized from the first cam...
Array< double, 1, 3 > e(1./3., 0.5, 2.)
The most common 5DOF 3D->2D calibration.
gtsam::Point2 project(const Vector5 &pw, double rho, OptionalJacobian< 2, 6 > H1={}, OptionalJacobian< 2, 5 > H2={}, OptionalJacobian< 2, 1 > H3={}) const
static Point2 Project1(const Point3 &point)
static const Pose3 pose(Rot3(Vector3(1, -1, -1).asDiagonal()), Point3(0, 0, 0.5))
Jet< T, N > sqrt(const Jet< T, N > &f)
Eigen::Matrix< double, Eigen::Dynamic, 1 > Vector
The most common 5DOF 3D->2D calibration.