diff --git a/src/pipeline/datatype/PointCloudDataBindings.cpp b/src/pipeline/datatype/PointCloudDataBindings.cpp index 560e219e0..d2e9299b7 100644 --- a/src/pipeline/datatype/PointCloudDataBindings.cpp +++ b/src/pipeline/datatype/PointCloudDataBindings.cpp @@ -55,12 +55,14 @@ void bind_pointclouddata(pybind11::module& m, void* pCallstack){ .def("getPoints", [](py::object &obj){ // creates numpy array (zero-copy) which holds correct information such as shape, ... dai::PointCloudData& data = obj.cast(); - py::array_t arr({data.getPoints().size(), 3UL}); + Point3f* points = (Point3f*)data.getData().data(); + unsigned long size = data.getData().size() / sizeof(Point3f); + py::array_t arr({size, 3UL}); auto ra = arr.mutable_unchecked(); - for (int i = 0; i < data.getPoints().size(); i++) { - ra(i, 0) = data.getPoints()[i].x; - ra(i, 1) = -data.getPoints()[i].y; - ra(i, 2) = data.getPoints()[i].z; + for (int i = 0; i < size; i++) { + ra(i, 0) = points[i].x; + ra(i, 1) = -points[i].y; + ra(i, 2) = points[i].z; } return arr; })