31 using namespace gtsam;
35 static const Cal3_S2 K(625, 625, 0, 0, 0);
67 boost::function<Camera(Pose3,Cal3_S2)>
f =
68 boost::bind(Camera::Create,_1,_2,boost::none,boost::none);
69 Matrix numericalH1 = numericalDerivative21<Camera,Pose3,Cal3_S2>(
f,
pose,
K);
71 Matrix numericalH2 = numericalDerivative22<Camera,Pose3,Cal3_S2>(
f,
pose,
K);
82 boost::function<Pose3(Camera)>
f =
83 boost::bind(&Camera::getPose,_1,boost::none);
84 Matrix numericalH = numericalDerivative11<Pose3,Camera>(
f,
camera);
110 Point3 xc(0,1,0),yc(0,0,-1),zc(-1,0,0);
117 Matrix R = camera2.pose().rotation().matrix();
153 Rot3 rot(1., 0., 0., 0., 0., 1., 0., -1., 0.);
158 pair<Point2, bool>
x = camera.projectSafe(expected);
169 Rot3 rot(1., 0., 0., 0., 0., 1., 0., -1., 0.);
172 Unit3 actual = camera.backprojectPointAtInfinity(
Point2(0,0));
174 Point2 x = camera.project(expected);
184 Rot3 rot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
187 Unit3 actual = camera.backprojectPointAtInfinity(
Point2(0,0));
189 Point2 x = camera.project(expected);
197 return Camera(pose,cal).project(point);
203 Matrix Dpose, Dpoint, Dcal;
216 return Camera(pose,cal).project(point3D);
221 Matrix Dpose, Dpoint, Dcal;
225 Point2 actual =
camera.project(point3D, Dpose, Dpoint, Dcal);
232 Matrix numerical_point2x2 = Hexpected2.block(0,0,2,2);
241 return camera.project2(point);
263 camera.project2(
point1, Dpose, Dpoint);
272 return camera.range(point);
289 return camera.range(pose);
325 return camera.range(camera3);
static Point2 project4(const Camera &camera, const Point3 &point)
int EIGEN_BLAS_FUNC() rot(int *n, RealScalar *px, int *incx, RealScalar *py, int *incy, RealScalar *pc, RealScalar *ps)
PinholeCamera< Cal3_S2 > Camera
static const Camera camera(pose, K)
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)
Point3 backproject(const Point2 &p, double depth, OptionalJacobian< 3, 6 > Dresult_dpose=boost::none, OptionalJacobian< 3, 2 > Dresult_dp=boost::none, OptionalJacobian< 3, 1 > Dresult_ddepth=boost::none, OptionalJacobian< 3, DimK > Dresult_dcal=boost::none) const
backproject a 2-dimensional point to a 3-dimensional point at given depth
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 origin
static const Unit3 point4_inf(0.16,-0.16,-1.0)
Rot2 R(Rot2::fromAngle(0.1))
static double range2(const Camera &camera, const Camera2 &camera2)
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)
internal::FixedSizeMatrix< Y, X1 >::type numericalDerivative21(const boost::function< Y(const X1 &, const X2 &)> &h, const X1 &x1, const X2 &x2, double delta=1e-5)
static const Unit3 point3_inf(0.16, 0.16,-1.0)
#define EXPECT_DOUBLES_EQUAL(expected, actual, threshold)
static const Point3 point2(-0.08, 0.08, 0.0)
static Point3 backproject(const Pose3 &pose, const Point2 &point, const double &depth)
double distance3(const Point3 &p1, const Point3 &q, OptionalJacobian< 1, 3 > H1, OptionalJacobian< 1, 3 > H2)
distance between two points
static const CalibratedCamera camera3(pose1)
static const Cal3Bundler K2(625, 1e-3, 1e-3)
Represents a 3D point on a unit sphere.
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)
internal::FixedSizeMatrix< Y, X2 >::type numericalDerivative22(boost::function< Y(const X1 &, const X2 &)> h, const X1 &x1, const X2 &x2, double delta=1e-5)
static const Pose3 pose(Rot3(Vector3(1,-1,-1).asDiagonal()), Point3(0, 0, 0.5))
#define EXPECT(condition)
static const Camera2 camera2(pose1, K2)
Point2(* f)(const Point3 &, OptionalJacobian< 2, 3 >)
Array< double, 1, 3 > e(1./3., 0.5, 2.)
static double range0(const Camera &camera, const Point3 &point)
static const Pose3 pose1(Rot3(), Point3(0, 1, 0.5))
Matrix< Scalar, Dynamic, Dynamic > C
static const Point3 point3(0.08, 0.08, 0.0)
bool assert_equal(const Matrix &expected, const Matrix &actual, double tol)
static const Point3 point1(-0.08,-0.08, 0.0)
static const Cal3_S2 K(625, 625, 0, 0, 0)
TEST(PinholeCamera, constructor)
static double range1(const Camera &camera, const Pose3 &pose)
static double range3(const Camera &camera, const CalibratedCamera &camera3)
static const Unit3 point2_inf(-0.16, 0.16,-1.0)
PinholeCamera< Cal3Bundler > Camera2
static Point2 projectInfinity3(const Pose3 &pose, const Unit3 &point3D, const Cal3_S2 &cal)
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 x
static Point2 project3(const Pose3 &pose, const Point3 &point, const Cal3_S2 &cal)
static const Camera camera1(pose1, K)
static const Unit3 point1_inf(-0.16,-0.16,-1.0)
Calibration used by Bundler.
static const Point3 point4(0.08,-0.08, 0.0)
The most common 5DOF 3D->2D calibration.