17 static const std::unordered_map<std::string, std::string>
19 {
"voxel_size",
"The voxel size of the volume in meters."},
21 "Resolution of local dense voxel blocks. By default 16 "
22 "is used to create 16^3 voxel blocks."},
24 "Number of estimate blocks per scene with the block "
25 "resolution set to 16 and the 6mm voxel resolution. "
26 "Typically 20000 for small scenes (a desk), 40000 for medium "
27 "scenes (a bedroom), 80000 for large scenes (an "
29 {
"transformation",
"A 4x4 3D transformation matrix."},
30 {
"device",
"The CPU or CUDA device used for the object."},
32 "The max clipping depth to filter noisy observations too "
34 {
"depth_min",
"The min clipping depth."},
36 "The scale factor to convert raw depth into meters."},
38 "The frame that contains raw depth and optionally images with "
39 "the same size from the input."},
41 "The frame that contains ray casted depth and optionally "
42 "color from the volumetric model."},
44 "Estimated number of surface points. Use -1 if no estimation "
47 "Weight threshold to filter outlier voxel blocks."},
48 {
"height",
"Height of an image frame."},
49 {
"width",
"Width of an image frame."},
50 {
"intrinsics",
"Intrinsic matrix stored in a 3x3 Tensor."},
51 {
"trunc_voxel_multiplier",
52 "Truncation distance multiplier in voxel size for signed "
53 "distance. For instance, "
54 "--trunc_voxel_multiplier=8 with --voxel_size=0.006(m) "
55 "creates a truncation distance of 0.048(m)."}};
58 py::module m_slam = m.def_submodule(
"slam",
"Tensor DenseSLAM pipeline.");
59 py::class_<Model> model(m_slam,
"Model",
60 "Volumetric model for Dense SLAM.");
61 py::detail::bind_copy_functions<Model>(model);
62 model.def(py::init<>());
63 model.def(py::init<float, int, int, core::Tensor, core::Device>(),
64 "Constructor of a VoxelBlockGrid",
"voxel_size"_a,
65 "block_resolution"_a = 16,
" block_count"_a = 10000,
76 py::call_guard<py::gil_scoped_release>(),
77 "Synthesize frame from the volumetric model using ray casting.",
78 "model_frame"_a,
"depth_scale"_a = 1000.0,
"depth_min"_a = 0.1,
79 "depth_max"_a = 3.0,
"trunc_voxel_multiplier"_a = 8.0,
80 "enable_color"_a =
false,
"weight_threshold"_a = -1.0);
86 py::call_guard<py::gil_scoped_release>(),
87 "Track input frame against raycasted frame from model.",
88 "input_frame"_a,
"model_frame"_a,
"depth_scale"_a = 1000.0,
89 "depth_max"_a = 3.0,
"depth_diff"_a = 0.07,
91 "Method.PointToPlane"),
92 "criteria"_a = (std::vector<odometry::OdometryConvergenceCriteria>){
98 py::call_guard<py::gil_scoped_release>(),
99 "Integrate an input frame to a volume.",
"input_frame"_a,
100 "depth_scale"_a = 1000.0,
"depth_max"_a = 3.0,
101 "trunc_voxel_multiplier"_a = 8.0);
106 py::call_guard<py::gil_scoped_release>(),
107 "Extract point cloud from the volumetric model.",
108 "weight_threshold"_a = 3.0,
"estimated_number"_a = -1);
113 py::call_guard<py::gil_scoped_release>(),
114 "Extract triangle mesh from the volumetric model.",
115 "weight_threshold"_a = 3.0,
"estimated_number"_a = -1);
121 "Get the underlying hash map from 3D coordinates to voxel blocks.");
123 "Get the maintained VoxelBlockGrid.");
125 "Active block coordinates from prior integration");
126 model.def_readwrite(
"transformation_frame_to_world",
128 "Get the 4x4 transformation matrix from the current "
129 "frame to the world frame.");
131 "Get the current frame index in a sequence.");
133 py::class_<Frame>
frame(m_slam,
"Frame",
134 "A frame container that stores a map from keys "
135 "(color, depth) to tensor images.");
136 py::detail::bind_copy_functions<Frame>(
frame);
137 frame.def(py::init<int, int, core::Tensor, core::Device>(),
"height"_a,
138 "width"_a,
"intrinsics"_a,
"device"_a);
146 "Set a 2D tensor to a image to the given key in the map.");
148 "Get a 2D tensor from a image from the given key in the map.");
150 "Set a 2D image to the given key in the map.");
152 "Get a 2D image from from the given key in the map.");
static Tensor Eye(int64_t n, Dtype dtype, const Device &device)
Create an identity matrix of size n x n.
void SetDataFromImage(const std::string &name, const t::geometry::Image &data)
core::Tensor GetData(const std::string &name) const
void SetData(const std::string &name, const core::Tensor &data)
t::geometry::Image GetDataAsImage(const std::string &name) const
void UpdateFramePose(int frame_id, const core::Tensor &T_frame_to_world)
void SynthesizeModelFrame(Frame &raycast_frame, float depth_scale=1000.0, float depth_min=0.1, float depth_max=3.0, float trunc_voxel_multiplier=8.0, bool enable_color=true, float weight_threshold=-1.0)
odometry::OdometryResult TrackFrameToModel(const Frame &input_frame, const Frame &raycast_frame, float depth_scale=1000.0, float depth_max=3.0, float depth_diff=0.07, odometry::Method method=odometry::Method::PointToPlane, const std::vector< odometry::OdometryConvergenceCriteria > &criteria={6, 3, 1})
core::Tensor GetCurrentFramePose() const
t::geometry::TriangleMesh ExtractTriangleMesh(float weight_threshold=3.0f, int estimated_number=-1)
void Integrate(const Frame &input_frame, float depth_scale=1000.0, float depth_max=3.0, float trunc_voxel_multiplier=8.0f)
core::HashMap GetHashMap()
Get block hashmap int the VoxelBlockGrid.
t::geometry::PointCloud ExtractPointCloud(float weight_threshold=3.0f, int estimated_number=-1)
t::geometry::VoxelBlockGrid voxel_grid_
Maintained volumetric map.
core::Tensor frustum_block_coords_
Active block coordinates from prior integration.
core::Tensor T_frame_to_world_
void ClassMethodDocInject(py::module &pybind_module, const std::string &class_name, const std::string &function_name, const std::unordered_map< std::string, std::string > &map_parameter_body_docs)
static const std::unordered_map< std::string, std::string > map_shared_argument_docstrings
void pybind_slam(py::module &m)
Generic file read and write utility for python interface.