slam/expressions.h
Go to the documentation of this file.
1 
8 #pragma once
9 
11 #include <gtsam/geometry/Pose2.h>
12 #include <gtsam/geometry/Cal3_S2.h>
14 #include <gtsam/geometry/Line3.h>
16 
17 namespace gtsam {
18 
19 // 2D Geometry
20 
24 
25 inline Point2_ transformTo(const Pose2_& x, const Point2_& p) {
26  return Point2_(x, &Pose2::transformTo, p);
27 }
28 
29 // 3D Geometry
30 
36 
37 inline Point3_ transformTo(const Pose3_& x, const Point3_& p) {
38  return Point3_(x, &Pose3::transformTo, p);
39 }
40 
41 inline Point3_ transformFrom(const Pose3_& x, const Point3_& p) {
42  return Point3_(x, &Pose3::transformFrom, p);
43 }
44 
45 inline Line3_ transformTo(const Pose3_ &wTc, const Line3_ &wL) {
46  Line3 (*f)(const Pose3 &, const Line3 &,
48  return Line3_(f, wTc, wL);
49 }
50 
51 namespace internal {
52 // define getter that returns value rather than reference
54  return pose.rotation(H);
55 }
56 } // namespace internal
57 
58 inline Rot3_ rotation(const Pose3_& pose) {
59  return Rot3_(internal::rotation, pose);
60 }
61 
62 inline Point3_ rotate(const Rot3_& x, const Point3_& p) {
63  return Point3_(x, &Rot3::rotate, p);
64 }
65 
66 inline Unit3_ rotate(const Rot3_& x, const Unit3_& p) {
67  return Unit3_(x, &Rot3::rotate, p);
68 }
69 
70 inline Point3_ unrotate(const Rot3_& x, const Point3_& p) {
71  return Point3_(x, &Rot3::unrotate, p);
72 }
73 
74 inline Unit3_ unrotate(const Rot3_& x, const Unit3_& p) {
75  return Unit3_(x, &Rot3::unrotate, p);
76 }
77 
78 // Projection
79 
82 
84 inline Point2_ project(const Point3_& p_cam) {
86  return Point2_(f, p_cam);
87 }
88 
89 inline Point2_ project(const Unit3_& p_cam) {
91  return Point2_(f, p_cam);
92 }
93 
94 namespace internal {
95 // Helper template for project2 expression below
96 template <class CAMERA, class POINT>
99  return camera.project2(p, Dcam, Dpoint);
100 }
101 }
102 
103 template <class CAMERA, class POINT>
104 Point2_ project2(const Expression<CAMERA>& camera_, const Expression<POINT>& p_) {
105  return Point2_(internal::project4<CAMERA, POINT>, camera_, p_);
106 }
107 
108 namespace internal {
109 // Helper template for project3 expression below
110 template <class CALIBRATION, class POINT>
111 inline Point2 project6(const Pose3& x, const Point3& p, const Cal3_S2& K,
113  OptionalJacobian<2, 5> Dcal) {
114  return PinholeCamera<Cal3_S2>(x, K).project(p, Dpose, Dpoint, Dcal);
115 }
116 }
117 
118 template <class CALIBRATION, class POINT>
119 inline Point2_ project3(const Pose3_& x, const Expression<POINT>& p,
120  const Expression<CALIBRATION>& K) {
121  return Point2_(internal::project6<CALIBRATION, POINT>, x, p, K);
122 }
123 
124 template <class CALIBRATION>
125 Point2_ uncalibrate(const Expression<CALIBRATION>& K, const Point2_& xy_hat) {
126  return Point2_(K, &CALIBRATION::uncalibrate, xy_hat);
127 }
128 
129 } // \namespace gtsam
Point3_ unrotate(const Rot3_ &x, const Point3_ &p)
Expression< Rot2 > Rot2_
Point2_ project(const Point3_ &p_cam)
Expression version of PinholeBase::Project.
Vector2 Point2
Definition: Point2.h:27
Give fixed size dimension of a type, fails at compile time if dynamic.
Definition: Manifold.h:164
Point2_ project2(const Expression< CAMERA > &camera_, const Expression< POINT > &p_)
Point3 unrotate(const Point3 &p, OptionalJacobian< 3, 3 > H1=boost::none, OptionalJacobian< 3, 3 > H2=boost::none) const
rotate point from world to rotated frame
Definition: Rot3.cpp:136
static Cal3_S2 K(500, 500, 0.1, 640/2, 480/2)
Expression< Point2 > Point2_
Expression< Cal3Bundler > Cal3Bundler_
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
Point3 rotate(const Point3 &p, OptionalJacobian< 3, 3 > H1=boost::none, OptionalJacobian< 3, 3 > H2=boost::none) const
Definition: Rot3M.cpp:149
Expression< Pose2 > Pose2_
Expression< Rot3 > Rot3_
Represents a 3D point on a unit sphere.
Definition: Unit3.h:42
Base class for all pinhole cameras.
Point3 transformFrom(const Point3 &point, OptionalJacobian< 3, 6 > Hself=boost::none, OptionalJacobian< 3, 3 > Hpoint=boost::none) const
takes point in Pose coordinates and transforms it to world coordinates
Definition: Pose3.cpp:298
Point3 transformTo(const Point3 &point, OptionalJacobian< 3, 6 > Hself=boost::none, OptionalJacobian< 3, 3 > Hpoint=boost::none) const
takes point in world coordinates and transforms it to Pose coordinates
Definition: Pose3.cpp:314
Point3_ transformFrom(const Pose3_ &x, const Point3_ &p)
Point2_ project3(const Pose3_ &x, const Expression< POINT > &p, const Expression< CALIBRATION > &K)
static const Pose3 pose(Rot3(Vector3(1,-1,-1).asDiagonal()), Point3(0, 0, 0.5))
Point3_ p_cam(x,&Pose3::transformTo, p)
Expression< Unit3 > Unit3_
Point2 project4(const CAMERA &camera, const POINT &p, OptionalJacobian< 2, CAMERA::dimension > Dcam, OptionalJacobian< 2, FixedDimension< POINT >::value > Dpoint)
Point2(* f)(const Point3 &, OptionalJacobian< 2, 3 >)
Point3_ rotate(const Rot3_ &x, const Point3_ &p)
4 dimensional manifold of 3D lines
Expression< Point3 > Point3_
traits
Definition: chartTesting.h:28
Expression< Cal3_S2 > Cal3_S2_
Point2_ uncalibrate(const Expression< CALIBRATION > &K, const Point2_ &xy_hat)
static Point2 Project(const Point3 &pc, OptionalJacobian< 2, 3 > Dpoint=boost::none)
float * p
Point2 project6(const Pose3 &x, const Point3 &p, const Cal3_S2 &K, OptionalJacobian< 2, 6 > Dpose, OptionalJacobian< 2, 3 > Dpoint, OptionalJacobian< 2, 5 > Dcal)
Line3 transformTo(const Pose3 &wTc, const Line3 &wL, OptionalJacobian< 4, 6 > Dpose, OptionalJacobian< 4, 4 > Dline)
Definition: Line3.cpp:94
Vector3 Point3
Definition: Point3.h:35
2D Pose
Rot3 rotation(const Pose3 &pose, OptionalJacobian< 3, 6 > H)
static const CalibratedCamera camera(kDefaultPose)
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
Expression< Line3 > Line3_
Calibration used by Bundler.
Expression< Pose3 > Pose3_
const Rot3 & rotation(OptionalJacobian< 3, 6 > Hself=boost::none) const
get rotation
Definition: Pose3.cpp:266
The most common 5DOF 3D->2D calibration.
GTSAM_EXPORT Point2 transformTo(const Point2 &point, OptionalJacobian< 2, 3 > Dpose=boost::none, OptionalJacobian< 2, 2 > Dpoint=boost::none) const
Definition: Pose2.cpp:207
Point2 uncalibrate(const CAL &K, const Point2 &p, OptionalJacobian< 2, 5 > Dcal, OptionalJacobian< 2, 2 > Dp)


gtsam
Author(s):
autogenerated on Sat May 8 2021 02:42:03