Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add pathlib support for visualizer and DepthNoiseSimulator
Browse files Browse the repository at this point in the history
sitic committed Jan 23, 2024

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
1 parent 2c9902b commit a8416aa
Showing 2 changed files with 32 additions and 11 deletions.
4 changes: 3 additions & 1 deletion cpp/pybind/t/io/class_io.cpp
Original file line number Diff line number Diff line change
@@ -221,7 +221,9 @@ Example::
# Save noisy depth image (uint16)
o3d.t.io.write_image("noisy_depth.png", im_dst)
)");
depth_noise_simulator.def(py::init<const std::string &>(),
depth_noise_simulator.def(py::init([](const fs::path &fielname) {
return DepthNoiseSimulator(fielname.string());
}),
"noise_model_path"_a);
depth_noise_simulator.def("simulate", &DepthNoiseSimulator::Simulate,
"im_src"_a, "depth_scale"_a = 1000.0f,
39 changes: 29 additions & 10 deletions cpp/pybind/visualization/visualizer.cpp
Original file line number Diff line number Diff line change
@@ -104,20 +104,39 @@ void pybind_visualizer(py::module &m) {
&Visualizer::CaptureScreenFloatBuffer,
"Function to capture screen and store RGB in a float buffer",
"do_render"_a = false)
.def("capture_screen_image", &Visualizer::CaptureScreenImage,
"Function to capture and save a screen image", "filename"_a,
"do_render"_a = false)
.def(
"capture_screen_image",
[](Visualizer &self, const fs::path &filename,
bool do_render) {
return self.CaptureScreenImage(filename.string(),
do_render);
},
"Function to capture and save a screen image", "filename"_a,
"do_render"_a = false)
.def("capture_depth_float_buffer",
&Visualizer::CaptureDepthFloatBuffer,
"Function to capture depth in a float buffer",
"do_render"_a = false)
.def("capture_depth_image", &Visualizer::CaptureDepthImage,
"Function to capture and save a depth image", "filename"_a,
"do_render"_a = false, "depth_scale"_a = 1000.0)
.def("capture_depth_point_cloud",
&Visualizer::CaptureDepthPointCloud,
"Function to capture and save local point cloud", "filename"_a,
"do_render"_a = false, "convert_to_world_coordinate"_a = false)
.def(
"capture_depth_image",
[](Visualizer &self, const fs::path &filename,
bool do_render, double depth_scale) {
self.CaptureDepthImage(filename.string(), do_render,
depth_scale);
},
"Function to capture and save a depth image", "filename"_a,
"do_render"_a = false, "depth_scale"_a = 1000.0)
.def(
"capture_depth_point_cloud",
[](Visualizer &self, const fs::path &filename,
bool do_render, bool convert_to_world_coordinate) {
self.CaptureDepthPointCloud(
filename.string(), do_render,
convert_to_world_coordinate);
},
"Function to capture and save local point cloud",
"filename"_a, "do_render"_a = false,
"convert_to_world_coordinate"_a = false)
.def("get_window_name", &Visualizer::GetWindowName)
.def("get_view_status", &Visualizer::GetViewStatus,
"Get the current view status as a json string of "

0 comments on commit a8416aa

Please sign in to comment.