2#include "base_vertex.h"
3#include "base_binary_edge.h"
4#include "base_unary_edge.h"
5#include "vertex_se3_expmap.h"
9#include <Eigen/Geometry>
13 using namespace Eigen;
24 class EdgeSE3 :
public BaseBinaryEdge<6, SE3Quat, VertexSE3Expmap, VertexSE3Expmap>
27 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
34 SE3Quat error_ = C *
m_a->estimate() *
m_b->estimate().inverse();
43 class EdgeStereoSE3ProjectXYZ :
public BaseBinaryEdge<3, Vector3<g_type>, VertexSBAPointXYZ, VertexSE3Expmap> {
45 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
54 bool isDepthPositive()
61 Vector3<g_type> cam_project(
const Vector3<g_type>& trans_xyz, g_type bf_a)
const
63 const g_type invz = g_type(1.0) / trans_xyz[2];
65 res[0] = trans_xyz[0] * invz * fx + cx;
66 res[1] = trans_xyz[1] * invz * fy + cy;
67 res[2] = res[0] - bf_a * invz;
71 EdgeStereoSE3ProjectXYZ()
72 :
BaseBinaryEdge<3, Vector3<g_type>, VertexSBAPointXYZ, VertexSE3Expmap>()
73 , fx(0), fy(0), cx(0), cy(0),
bf(0)
80 Vector3<g_type> xyz =
m_a->estimate();
81 Vector3<g_type> xyz_trans = T.
map(xyz);
83 const Matrix3<g_type> R = T.
rotation().toRotationMatrix();
85 g_type x = xyz_trans[0];
86 g_type y = xyz_trans[1];
87 g_type z = xyz_trans[2];
125 g_type fx, fy, cx, cy,
bf;
128 class EdgeStereoSE3ProjectXYZOnlyPose :
public BaseUnaryEdge<3, Vector3<g_type>, VertexSE3Expmap> {
130 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
132 EdgeStereoSE3ProjectXYZOnlyPose() : fx(0), fy(0), cx(0), cy(0),
bf(0) {}
141 bool isDepthPositive()
const
147 Vector2<g_type> project2d(
const Vector3<g_type>& v)
150 res(0) = v(0) / v(2);
151 res(1) = v(1) / v(2);
155 Vector3<g_type> unproject2d(
const Vector2<g_type>& v)
169 Vector3<g_type> cam_project(
const Vector3<g_type>& trans_xyz)
const
171 const g_type invz = g_type(1.0) / trans_xyz[2];
173 res[0] = trans_xyz[0] * invz * fx + cx;
174 res[1] = trans_xyz[1] * invz * fy + cy;
175 res[2] = res[0] -
bf * invz;
181 Vector3<g_type> xyz_trans =
m_vertex->estimate().map(
Xw);
183 g_type x = xyz_trans[0];
184 g_type y = xyz_trans[1];
187 g_type invz = g_type(1.0) / xyz_trans[2];
188 g_type invz_2 = invz * invz;
212 g_type fx, fy, cx, cy,
bf;
JacobianXiOplusType _jacobianOplusXi
JacobianXjOplusType _jacobianOplusXj
JacobianXiOplusType _jacobianOplusXi
const EstimateType & estimate() const
return the current estimate of the vertex
void computeError() final override
Computes the error of the edge and stores it internally.
g_type bf
Camera intrinsics: focal lengths, principal point, and stereo baseline * focal length.
Vector3< g_type > Xw
Known 3D world point.
void linearizeOplus() final override
Linearizes the oplus operator in the vertex, and stores the result in temporary variables _jacobianOp...
void computeError() final override
Computes the error of the edge and stores it internally.
EIGEN_MAKE_ALIGNED_OPERATOR_NEW void computeError() final override
Computes the error of the edge and stores it internally.
void linearizeOplus() final override
Numerically linearizes the oplus operator by finite differences for both vertices.
g_type bf
Camera intrinsics: focal lengths, principal point, and stereo baseline * focal length.
SE(3) rigid body transformation represented by a unit quaternion and translation vector.
const Quaternion< g_type > & rotation() const
Returns a const reference to the rotation quaternion.
Vector6d log() const
Computes the logarithmic map (SE3 -> 6D tangent vector).
Vector3< g_type > map(const Vector3< g_type > &xyz) const
Transforms a 3D point: R*xyz + t.
The primary namespace for the NDEVR SDK.
Eigen::Matrix< g_type, 6, 6 > Matrix6d
6x6 matrix type for SE3 operations.