19 namespace integration {
21 template <
class TSDFVolumeBase = TSDFVolume>
24 using TSDFVolumeBase::TSDFVolumeBase;
25 void Reset()
override { PYBIND11_OVERLOAD_PURE(
void, TSDFVolumeBase, ); }
28 const Eigen::Matrix4d &extrinsic)
override {
29 PYBIND11_OVERLOAD_PURE(
void, TSDFVolumeBase,
image, intrinsic,
33 PYBIND11_OVERLOAD_PURE(std::shared_ptr<ccPointCloud>, TSDFVolumeBase, );
36 PYBIND11_OVERLOAD_PURE(std::shared_ptr<ccMesh>, TSDFVolumeBase, );
42 py::native_enum<TSDFVolumeColorType>(m,
"TSDFVolumeColorType",
"enum.Enum",
43 "Enum class for TSDFVolumeColorType.")
51 py::class_<TSDFVolume, PyTSDFVolume<TSDFVolume>> tsdfvolume(
52 m,
"TSDFVolume", R
"(Base class of the Truncated
53 Signed Distance Function (TSDF) volume This volume is usually used to integrate
54 surface data (e.g., a series of RGB-D images) into a Mesh or PointCloud. The
55 basic technique is presented in the following paper:
57 A volumetric method for building complex models from range images
59 B. Curless and M. Levoy
64 "Function to reset the TSDFVolume")
66 "Function to integrate an RGB-D image into the volume",
67 "image"_a,
"intrinsic"_a,
"extrinsic"_a)
69 "Function to extract a point cloud with normals")
71 "Function to extract a triangle mesh")
73 "float: Length of the voxel in meters.")
75 "float: Truncation value for signed distance "
78 "integration.TSDFVolumeColorType: Color type of the "
83 m,
"TSDFVolume",
"integrate",
84 {{
"image",
"RGBD image."},
85 {
"intrinsic",
"Pinhole camera intrinsic parameters."},
86 {
"extrinsic",
"Extrinsic parameters."}});
91 py::class_<UniformTSDFVolume, PyTSDFVolume<UniformTSDFVolume>,
TSDFVolume>
93 m,
"UniformTSDFVolume",
94 "UniformTSDFVolume implements the classic TSDF "
95 "volume with uniform voxel grid (Curless and Levoy 1996).");
96 py::detail::bind_copy_functions<UniformTSDFVolume>(uniform_tsdfvolume);
98 .def(py::init([](
double length,
int resolution,
double sdf_trunc,
103 "length"_a,
"resolution"_a,
"sdf_trunc"_a,
"color_type"_a)
104 .def(py::init([](
double length,
int resolution,
double sdf_trunc,
106 Eigen::Vector3d origin) {
110 "length"_a,
"resolution"_a,
"sdf_trunc"_a,
"color_type"_a,
116 "UniformTSDFVolume ") +
118 ? std::string(
"without color.")
119 : std::string(
"with color."));
121 .def(
"extract_voxel_point_cloud",
123 "Debug function to extract the voxel data into a point cloud.")
125 "Debug function to extract the voxel data VoxelGrid.")
127 "Debug function to extract the volume TSDF data.")
129 "Debug function to extract the volume color data.")
131 "Debug function to inject the voxel TSDF data.",
"tsdf"_a)
133 "Debug function to inject the voxel Color data.",
"color"_a)
135 "Total length, where ``voxel_length = length / "
138 "Resolution over the total length, where "
139 "``voxel_length = length / resolution``");
141 "extract_voxel_point_cloud");
145 py::class_<ScalableTSDFVolume, PyTSDFVolume<ScalableTSDFVolume>,
TSDFVolume>
146 scalable_tsdfvolume(m,
"ScalableTSDFVolume", R
"(The
147 ScalableTSDFVolume implements a more memory efficient data structure for
148 volumetric integration.
150 This implementation is based on the following repository:
151 https://github.com/qianyizh/ElasticReconstruction/tree/master/Integrate
153 An observed depth pixel gives two types of information: (a) an approximation
154 of the nearby surface, and (b) empty space from the camera to the surface.
155 They induce two core concepts of volumetric integration: weighted average of
156 a truncated signed distance function (TSDF), and carving. The weighted
157 average of TSDF is great in addressing the Gaussian noise along surface
158 normal and producing a smooth surface output. The carving is great in
159 removing outlier structures like floating noise pixels and bumps along
162 Ref: Dense Scene Reconstruction with Points of Interest
164 Q.-Y. Zhou and V. Koltun
166 In SIGGRAPH, 2013)");
167 py::detail::bind_copy_functions<ScalableTSDFVolume>(scalable_tsdfvolume);
169 .def(py::init([](double voxel_length,
double sdf_trunc,
171 int volume_unit_resolution,
172 int depth_sampling_stride) {
174 voxel_length, sdf_trunc, color_type,
175 volume_unit_resolution, depth_sampling_stride);
177 "voxel_length"_a,
"sdf_trunc"_a,
"color_type"_a,
178 "volume_unit_resolution"_a = 16,
"depth_sampling_stride"_a = 4)
183 "ScalableTSDFVolume ") +
185 ? std::string(
"without color.")
186 : std::string(
"with color."));
188 .def(
"extract_voxel_point_cloud",
190 "Debug function to extract the voxel data into a point "
193 "extract_voxel_point_cloud");
201 py::module m_submodule =
202 m.def_submodule(
"integration",
"Integration pipeline.");
std::shared_ptr< core::Tensor > image
Contains the pinhole camera intrinsic parameters.
RGBDImage is for a pair of registered color and depth images,.
void Reset() override
Function to reset the TSDFVolume.
std::shared_ptr< ccPointCloud > ExtractPointCloud() override
Function to extract a point cloud with normals.
void Integrate(const geometry::RGBDImage &image, const camera::PinholeCameraIntrinsic &intrinsic, const Eigen::Matrix4d &extrinsic) override
Function to integrate an RGB-D image into the volume.
std::shared_ptr< ccMesh > ExtractTriangleMesh() override
Function to extract a triangle mesh, using the marching cubes algorithm. (https://en....
std::shared_ptr< ccPointCloud > ExtractVoxelPointCloud()
Debug function to extract the voxel data into a point cloud.
Base class of the Truncated Signed Distance Function (TSDF) volume.
double sdf_trunc_
Truncation value for signed distance function (SDF).
virtual std::shared_ptr< ccMesh > ExtractTriangleMesh()=0
Function to extract a triangle mesh, using the marching cubes algorithm. (https://en....
virtual void Reset()=0
Function to reset the TSDFVolume.
virtual void Integrate(const geometry::RGBDImage &image, const camera::PinholeCameraIntrinsic &intrinsic, const Eigen::Matrix4d &extrinsic)=0
Function to integrate an RGB-D image into the volume.
double voxel_length_
Length of the voxel in meters.
virtual std::shared_ptr< ccPointCloud > ExtractPointCloud()=0
Function to extract a point cloud with normals.
TSDFVolumeColorType color_type_
Color type of the TSDF volume.
__host__ __device__ float length(float2 v)
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)
void pybind_integration_classes(py::module &m)
void pybind_integration_methods(py::module &m)
void pybind_integration(py::module &m)
@ Gray32
32 bit GrayScale.
Generic file read and write utility for python interface.