22 template <
class RGBDOdometryJacobianBase = RGBDOdometryJacobian>
25 using RGBDOdometryJacobianBase::RGBDOdometryJacobianBase;
28 std::vector<Eigen::Vector6d, utility::Vector6d_allocator> &J_r,
29 std::vector<double> &r,
30 std::vector<double> &w,
36 const Eigen::Matrix3d &intrinsic,
37 const Eigen::Matrix4d &extrinsic,
39 PYBIND11_OVERLOAD_PURE(
void, RGBDOdometryJacobianBase, row, J_r, r,
40 source, target, source_xyz, target_dx, target_dy,
41 extrinsic, corresps, intrinsic);
47 py::class_<OdometryOption> odometry_option(
48 m,
"OdometryOption",
"Class that defines Odometry options.");
51 [](std::vector<int> iteration_number_per_pyramid_level,
52 double max_depth_diff,
double min_depth,
55 iteration_number_per_pyramid_level,
56 max_depth_diff, min_depth, max_depth);
58 "iteration_number_per_pyramid_level"_a =
59 std::vector<int>{20, 10, 5},
60 "max_depth_diff"_a = 0.03,
"min_depth"_a = 0.0,
62 .def_readwrite(
"iteration_number_per_pyramid_level",
64 "List(int): Iteration number per image pyramid "
65 "level, typically larger image in the pyramid have "
66 "lower interation number to reduce computation "
69 "Maximum depth difference to be considered as "
70 "correspondence. In depth image domain, if two "
71 "aligned pixels have a depth difference less than "
72 "specified value, they are considered as a "
73 "correspondence. Larger value induce more "
74 "aggressive search, but it is prone to unstable "
77 "Pixels that has smaller than specified depth "
78 "values are ignored.")
80 "Pixels that has larger than specified depth values "
83 int num_pyramid_level =
85 std::string str_iteration_number_per_pyramid_level_ =
"[ ";
86 for (
int i = 0; i < num_pyramid_level; i++)
87 str_iteration_number_per_pyramid_level_ +=
91 str_iteration_number_per_pyramid_level_ +=
"] ";
92 return std::string(
"OdometryOption class.") +
95 std::string(
"\niteration_number_per_pyramid_level = ") +
96 str_iteration_number_per_pyramid_level_ +
97 std::string(
"\nmax_depth_diff = ") +
99 std::string(
"\nmin_depth = ") +
101 std::string(
"\nmax_depth = ") +
109 m,
"RGBDOdometryJacobian",
110 "Base class that computes Jacobian from two RGB-D images.");
117 jacobian_color(m,
"RGBDOdometryJacobianFromColorTerm",
118 R
"(Class to Compute Jacobian using color term.
120 Energy: :math:`(I_p-I_q)^2.`
124 F. Steinbrucker, J. Sturm, and D. Cremers.
126 Real-time visual odometry from dense RGB-D images.
128 In ICCV Workshops, 2011.)");
129 py::detail::bind_default_constructor<RGBDOdometryJacobianFromColorTerm>(
131 py::detail::bind_copy_functions<RGBDOdometryJacobianFromColorTerm>(
135 return std::string(
"RGBDOdometryJacobianFromColorTerm");
143 jacobian_hybrid(m,
"RGBDOdometryJacobianFromHybridTerm",
144 R
"(Class to compute Jacobian using hybrid term
146 Energy: :math:`(I_p-I_q)^2 + \lambda(D_p-D_q')^2`
150 J. Park, Q.-Y. Zhou, and V. Koltun
152 Anonymous submission.)");
153 py::detail::bind_default_constructor<RGBDOdometryJacobianFromHybridTerm>(
155 py::detail::bind_copy_functions<RGBDOdometryJacobianFromHybridTerm>(
159 return std::string(
"RGBDOdometryJacobianFromHybridTerm");
165 py::call_guard<py::gil_scoped_release>(),
166 "Function to estimate 6D rigid motion from two RGBD image pairs. "
167 "Output: (is_success, 4x4 motion matrix, 6x6 information matrix).",
168 "rgbd_source"_a,
"rgbd_target"_a,
170 "odo_init"_a = Eigen::Matrix4d::Identity(),
171 "jacobian"_a = RGBDOdometryJacobianFromHybridTerm(),
174 m,
"compute_rgbd_odometry",
176 {
"rgbd_source",
"Source RGBD image."},
177 {
"rgbd_target",
"Target RGBD image."},
178 {
"pinhole_camera_intrinsic",
"Camera intrinsic parameters"},
179 {
"odo_init",
"Initial 4x4 motion matrix estimation."},
181 "The odometry Jacobian method to use. Can be "
183 "RGBDOdometryJacobianFromHybridTerm()`` or "
184 "``RGBDOdometryJacobianFromColorTerm("
186 {
"option",
"Odometry hyper parameteres."},
191 py::module m_submodule = m.def_submodule(
"odometry",
"Odometry pipeline.");
Contains the pinhole camera intrinsic parameters.
The Image class stores image with customizable width, height, num of channels and bytes per channel.
RGBDImage is for a pair of registered color and depth images,.
std::vector< int > iteration_number_per_pyramid_level_
double min_depth_
Pixels that has larger than specified depth values are ignored.
double max_depth_
Pixels that has larger than specified depth values are ignored.
void ComputeJacobianAndResidual(int row, std::vector< Eigen::Vector6d, utility::Vector6d_allocator > &J_r, std::vector< double > &r, std::vector< double > &w, const geometry::RGBDImage &source, const geometry::RGBDImage &target, const geometry::Image &source_xyz, const geometry::RGBDImage &target_dx, const geometry::RGBDImage &target_dy, const Eigen::Matrix3d &intrinsic, const Eigen::Matrix4d &extrinsic, const CorrespondenceSetPixelWise &corresps) const override
Class to compute Jacobian using color term.
Class to compute Jacobian using hybrid term.
Base class that computes Jacobian from two RGB-D images.
void FunctionDocInject(py::module &pybind_module, const std::string &function_name, const std::unordered_map< std::string, std::string > &map_parameter_body_docs)
std::tuple< bool, Eigen::Matrix4d, Eigen::Matrix6d > ComputeRGBDOdometry(const geometry::RGBDImage &source, const geometry::RGBDImage &target, const camera::PinholeCameraIntrinsic &pinhole_camera_intrinsic, const Eigen::Matrix4d &odo_init, const RGBDOdometryJacobian &jacobian_method, const OdometryOption &option)
Function to estimate 6D rigid motion from two RGBD image pairs.
void pybind_odometry(py::module &m)
void pybind_odometry_classes(py::module &m)
std::vector< Eigen::Vector4i, utility::Vector4i_allocator > CorrespondenceSetPixelWise
void pybind_odometry_methods(py::module &m)
Generic file read and write utility for python interface.
std::string to_string(const T &n)