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, boost::none, boost::none);
102 TEST( InvDepthFactor, Dproject_landmark)
105 double inv_depth(1./4);
109 inv_camera.
project(landmark, inv_depth, boost::none, actual, boost::none);
114 TEST( InvDepthFactor, Dproject_inv_depth)
117 double inv_depth(1./4);
121 inv_camera.
project(landmark, inv_depth, boost::none, boost::none, actual);
129 double inv_depth(1./4);
135 boost::tie(actual_vec, actual_inv) = inv_camera.
backproject(z, 4);
141 TEST(InvDepthFactor, backproject2)
145 double inv_depth(1./10);
151 boost::tie(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)
PinholeCamera< Cal3_S2 > level_camera(level_pose,*K)
Concept check for values that can be used in unit tests.
static int runAllTests(TestResult &result)
std::pair< Vector5, double > backproject(const gtsam::Point2 &pi, const double depth) const
EIGEN_DEVICE_FUNC const SqrtReturnType sqrt() const
internal::FixedSizeMatrix< Y, X3 >::type numericalDerivative33(boost::function< Y(const X1 &, const X2 &, const X3 &)> h, const X1 &x1, const X2 &x2, const X3 &x3, double delta=1e-5)
Some functions to compute numerical derivatives.
internal::FixedSizeMatrix< Y, X1 >::type numericalDerivative31(boost::function< Y(const X1 &, const X2 &, const X3 &)> h, const X1 &x1, const X2 &x2, const X3 &x3, double delta=1e-5)
#define EXPECT_DOUBLES_EQUAL(expected, actual, threshold)
static Point3 backproject(const Pose3 &pose, const Point2 &point, const double &depth)
static Point3 landmark(0, 0, 5)
Base class for all pinhole cameras.
internal::FixedSizeMatrix< Y, X2 >::type numericalDerivative32(boost::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)
gtsam::Point2 project(const Vector5 &pw, double rho, boost::optional< gtsam::Matrix & > H1=boost::none, boost::optional< gtsam::Matrix & > H2=boost::none, boost::optional< gtsam::Matrix & > H3=boost::none) const
Point2 project_(const Pose3 &pose, const Vector5 &landmark, const double &inv_depth)
static const Pose3 pose(Rot3(Vector3(1,-1,-1).asDiagonal()), Point3(0, 0, 0.5))
#define EXPECT(condition)
EIGEN_DEVICE_FUNC const AtanReturnType atan() const
Inverse Depth Camera based on Civera09tro, Montiel06rss. Landmarks are initialized from the first cam...
Array< double, 1, 3 > e(1./3., 0.5, 2.)
bool assert_equal(const Matrix &expected, const Matrix &actual, double tol)
static Point2 Project1(const Point3 &point)
Eigen::Matrix< double, Eigen::Dynamic, 1 > Vector
boost::shared_ptr< Cal3_S2 > shared_ptr
The most common 5DOF 3D->2D calibration.