| 48 | } |
| 49 | |
| 50 | void BindDepthMap(pybind11::module& m) { |
| 51 | py::classh<DepthMap>(m, "DepthMap") |
| 52 | .def(py::init<>()) |
| 53 | .def(py::init<size_t, size_t, float, float>(), |
| 54 | "width"_a, |
| 55 | "height"_a, |
| 56 | "depth_min"_a, |
| 57 | "depth_max"_a) |
| 58 | .def("to_array", &ArrayFromDepthMap) |
| 59 | .def_static("from_array", |
| 60 | &DepthMapFromArray, |
| 61 | "array"_a, |
| 62 | "depth_min"_a, |
| 63 | "depth_max"_a, |
| 64 | "Create depth map as a copy of array. Returns depth map " |
| 65 | "with shape (H, W).") |
| 66 | .def("rescale", &DepthMap::Rescale, "factor"_a, "Rescale depth map.") |
| 67 | .def("downsize", |
| 68 | &DepthMap::Downsize, |
| 69 | "max_width"_a, |
| 70 | "max_height"_a, |
| 71 | "Downsize depth map to fit maximum dimensions.") |
| 72 | .def("to_bitmap", |
| 73 | &DepthMap::ToBitmap, |
| 74 | "min_percentile"_a, |
| 75 | "max_percentile"_a, |
| 76 | "Convert depth map to bitmap for visualization.") |
| 77 | .def_property_readonly( |
| 78 | "width", &DepthMap::GetWidth, "Width of the depth map.") |
| 79 | .def_property_readonly( |
| 80 | "height", &DepthMap::GetHeight, "Height of the depth map.") |
| 81 | .def_property_readonly( |
| 82 | "depth_min", &DepthMap::GetDepthMin, "Minimum depth value.") |
| 83 | .def_property_readonly( |
| 84 | "depth_max", &DepthMap::GetDepthMax, "Maximum depth value.") |
| 85 | .def("read", |
| 86 | &DepthMap::Read, |
| 87 | "path"_a, |
| 88 | "Read depth map from file at given path.") |
| 89 | .def("write", |
| 90 | &DepthMap::Write, |
| 91 | "path"_a, |
| 92 | "Write depth map to file at given path.") |
| 93 | .def("__repr__", &CreateRepresentation<DepthMap>); |
| 94 | } |