2#include "base_unary_edge.h"
3#include "types_six_dof_expmap.h"
5#include "GraphOptimization/Headers/GeometricCamera.h"
6#include <Eigen/Geometry>
27 bool isDepthPositive()
35 g_type x = xyz_trans[0];
36 g_type y = xyz_trans[1];
37 g_type z = xyz_trans[2];
39 Eigen::Matrix<g_type, 3, 6> SE3deriv;
40 SE3deriv << 0.f, z, -y, 1.f, 0.f, 0.f,
41 -z, 0.f, x, 0.f, 1.f, 0.f,
42 y, -x, 0.f, 0.f, 0.f, 1.f;
48 Eigen::Vector3<g_type> Xw;
49 GeometricCamera* pCamera =
nullptr;
51 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
55 class EdgeSE3ProjectXYZOnlyPoseToBody :
public BaseUnaryEdge<2, Eigen::Vector2<g_type>, VertexSE3Expmap>
58 EdgeSE3ProjectXYZOnlyPoseToBody()
61 bool isDepthPositive()
75 Eigen::Vector3<g_type> X_l = T_lw.map(
Xw);
76 Eigen::Vector3<g_type> X_r =
mTrl.
map(T_lw.map(
Xw));
82 Eigen::Matrix<g_type, 3, 6> SE3deriv;
83 SE3deriv << 0.f, z_w, -y_w, 1.f, 0.f, 0.f,
84 -z_w, 0.f, x_w, 0.f, 1.f, 0.f,
85 y_w, -x_w, 0.f, 0.f, 0.f, 1.f;
89 Eigen::Vector3<g_type>
Xw;
93 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
97 class EdgeSE3ProjectXYZ :
public BaseBinaryEdge<2, Eigen::Vector2<g_type>, VertexSBAPointXYZ, VertexSE3Expmap>
103 bool isDepthPositive()
105 return (
m_b->estimate().map(
m_a->estimate()))(2) > 0.0;
117 Eigen::Vector3<g_type> xyz =
m_a->estimate();
118 Eigen::Vector3<g_type> xyz_trans = T.map(xyz);
120 g_type x = xyz_trans[0];
121 g_type y = xyz_trans[1];
122 g_type z = xyz_trans[2];
128 Eigen::Matrix<g_type, 3, 6> SE3deriv;
129 SE3deriv << 0.f, z, -y, 1.f, 0.f, 0.f,
130 -z, 0.f, x, 0.f, 1.f, 0.f,
131 y, -x, 0.f, 0.f, 0.f, 1.f;
137 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
141 class EdgeSE3ProjectXYZToBody :
public BaseBinaryEdge<2, Eigen::Vector2<g_type>, VertexSBAPointXYZ, VertexSE3Expmap> {
143 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
144 EdgeSE3ProjectXYZToBody()
158 Eigen::Vector3<g_type> X_w =
m_a->estimate();
159 Eigen::Vector3<g_type> X_l = T_lw.map(X_w);
160 Eigen::Vector3<g_type> X_r =
mTrl.
map(T_lw.map(X_w));
168 Eigen::Matrix<g_type, 3, 6> SE3deriv;
169 SE3deriv << 0.f, z, -y, 1.f, 0.f, 0.f,
170 -z, 0.f, x, 0.f, 1.f, 0.f,
171 y, -x, 0.f, 0.f, 0.f, 1.f;
175 bool isDepthPositive() {
186 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
198 virtual void setToOriginImpl()
218 class EdgeSim3ProjectXYZ :
public BaseBinaryEdge<2, Eigen::Vector2<g_type>, VertexSBAPointXYZ, VertexSim3Expmap>
221 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
238 class EdgeInverseSim3ProjectXYZ :
public BaseBinaryEdge<2, Eigen::Vector2<g_type>, VertexSBAPointXYZ, VertexSim3Expmap>
241 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
242 EdgeInverseSim3ProjectXYZ()
virtual void linearizeOplus()
JacobianXiOplusType _jacobianOplusXi
JacobianXjOplusType _jacobianOplusXj
virtual void linearizeOplus()
JacobianXiOplusType _jacobianOplusXi
const EstimateType & estimate() const
return the current estimate of the vertex
void setEstimate(const EstimateType &et)
void computeError() final override
Computes the error of the edge and stores it internally.
GeometricCamera * pCamera
Pointer to the camera model.
SE3Quat mTrl
Transform from the left (reference) to the right (body) camera.
Eigen::Vector3< g_type > Xw
3D world point coordinate.
void computeError() final override
Computes the error of the edge and stores it internally.
EdgeSE3ProjectXYZOnlyPose()
Default constructor.
void computeError() final override
Computes the reprojection error using the camera model.
SE3Quat mTrl
Transform from left (reference) to right (body) camera.
void computeError() final override
Computes the error of the edge and stores it internally.
GeometricCamera * pCamera
Pointer to the camera model.
GeometricCamera * pCamera
Pointer to the camera model used for projection.
void computeError() final override
Computes the error of the edge and stores it internally.
void computeError() final override
Computes the error of the edge and stores it internally.
Abstract interface for geometric camera models (pinhole, fisheye, etc.).
virtual Eigen::Matrix< g_type, 2, 3 > projectJac(const Eigen::Vector3< g_type > &v3D)=0
Computes the 2x3 Jacobian of the projection function.
bool _marginalized
Whether this vertex is marginalized (Schur complement).
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.
Vector3< g_type > map(const Vector3< g_type > &xyz) const
Transforms a 3D point: R*xyz + t.
SE3 Vertex parameterized internally with a transformation matrix and externally with its exponential ...
Vertex for Sim3 similarity transformations (7-DoF: rotation, translation, scale).
virtual void oplusImpl(const g_type *update_)
update the position of the node from the parameters in v.
bool _fix_scale
Whether to fix the scale during optimization.
GeometricCamera * pCamera2
Camera models for the two views.
The primary namespace for the NDEVR SDK.
Eigen::Matrix< g_type, 7, 1 > Vector7d
7D vector for quaternion + translation representation.
Similarity transformation in 3D (rotation + translation + scale).