From 6d84e5e1594afa37ece145a71bac69ffa2ba0ae1 Mon Sep 17 00:00:00 2001 From: Michel Breyer Date: Mon, 12 Jun 2017 16:28:21 +0200 Subject: [PATCH] fix memcpy of depth and segmentation images to numpy arrays --- examples/pybullet/pybullet.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/pybullet/pybullet.c b/examples/pybullet/pybullet.c index 0c7ae9f0e..f7e5b0d82 100644 --- a/examples/pybullet/pybullet.c +++ b/examples/pybullet/pybullet.c @@ -5178,9 +5178,9 @@ static PyObject* pybullet_getCameraImage(PyObject* self, PyObject* args, PyObjec memcpy(PyArray_DATA(pyRGB), imageData.m_rgbColorData, imageData.m_pixelHeight * imageData.m_pixelWidth * bytesPerPixel); memcpy(PyArray_DATA(pyDep), imageData.m_depthValues, - imageData.m_pixelHeight * imageData.m_pixelWidth); + imageData.m_pixelHeight * imageData.m_pixelWidth * sizeof(float)); memcpy(PyArray_DATA(pySeg), imageData.m_segmentationMaskValues, - imageData.m_pixelHeight * imageData.m_pixelWidth); + imageData.m_pixelHeight * imageData.m_pixelWidth * sizeof(int)); PyTuple_SetItem(pyResultList, 2, pyRGB); PyTuple_SetItem(pyResultList, 3, pyDep);