From 878e3d57f6f8ed01045dbe1956aeabd727836d03 Mon Sep 17 00:00:00 2001 From: James Braza Date: Sun, 2 Jan 2022 15:08:16 -0500 Subject: Added comment giving confidence in the changing w x h orderings --- examples/pybullet/examples/getCameraImageTest.py | 1 + 1 file changed, 1 insertion(+) diff --git a/examples/pybullet/examples/getCameraImageTest.py b/examples/pybullet/examples/getCameraImageTest.py index ceae99566..7b894e3b0 100644 --- a/examples/pybullet/examples/getCameraImageTest.py +++ b/examples/pybullet/examples/getCameraImageTest.py @@ -31,6 +31,7 @@ images = p.getCameraImage(width, projection_matrix, shadow=True, renderer=p.ER_BULLET_HARDWARE_OPENGL) +# NOTE: the ordering of height and width change based on the conversion rgb_opengl = np.reshape(images[2], (height, width, 4)) * 1. / 255. depth_buffer_opengl = np.reshape(images[3], [width, height]) depth_opengl = far * near / (far - (far - near) * depth_buffer_opengl) -- cgit v1.2.1 From 72dc1bb4dd14e9fa9ee18f95e7b8c9ebd42bd424 Mon Sep 17 00:00:00 2001 From: James Braza Date: Sun, 2 Jan 2022 15:11:17 -0500 Subject: Added numpy reshapings to raw image --- examples/pybullet/examples/pointCloudFromCameraImage.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/pybullet/examples/pointCloudFromCameraImage.py b/examples/pybullet/examples/pointCloudFromCameraImage.py index a156090f8..c56a3eb86 100644 --- a/examples/pybullet/examples/pointCloudFromCameraImage.py +++ b/examples/pybullet/examples/pointCloudFromCameraImage.py @@ -72,8 +72,8 @@ imgW = int(width / 10) imgH = int(height / 10) img = p.getCameraImage(imgW, imgH, renderer=p.ER_BULLET_HARDWARE_OPENGL) -rgbBuffer = img[2] -depthBuffer = img[3] +rgbBuffer = np.reshape(img[2], (imgH, imgW, 4)) +depthBuffer = np.reshape(img[3], [imgW, imgH]) print("rgbBuffer.shape=", rgbBuffer.shape) print("depthBuffer.shape=", depthBuffer.shape) -- cgit v1.2.1 From 0e114e9f9b6e53a96d810d935d358b62d8defffe Mon Sep 17 00:00:00 2001 From: James Braza Date: Sun, 2 Jan 2022 15:20:30 -0500 Subject: Added comment about why H x W differ from expected --- examples/pybullet/examples/pointCloudFromCameraImage.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/examples/pybullet/examples/pointCloudFromCameraImage.py b/examples/pybullet/examples/pointCloudFromCameraImage.py index c56a3eb86..16e85db2d 100644 --- a/examples/pybullet/examples/pointCloudFromCameraImage.py +++ b/examples/pybullet/examples/pointCloudFromCameraImage.py @@ -73,7 +73,9 @@ imgH = int(height / 10) img = p.getCameraImage(imgW, imgH, renderer=p.ER_BULLET_HARDWARE_OPENGL) rgbBuffer = np.reshape(img[2], (imgH, imgW, 4)) -depthBuffer = np.reshape(img[3], [imgW, imgH]) +# Note: this depth buffer's reshaping does not match the [w, h] convention for +# OpenGL depth buffers. See getCameraImageTest.py for an OpenGL depth buffer +depthBuffer = np.reshape(img[3], [imgH, imgW]) print("rgbBuffer.shape=", rgbBuffer.shape) print("depthBuffer.shape=", depthBuffer.shape) -- cgit v1.2.1 From 51a5aa802667456d14af99c181550e63d780fca3 Mon Sep 17 00:00:00 2001 From: James Braza Date: Sun, 2 Jan 2022 15:30:23 -0500 Subject: Added forgotten capitalization of code tag --- examples/pybullet/examples/pointCloudFromCameraImage.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/pybullet/examples/pointCloudFromCameraImage.py b/examples/pybullet/examples/pointCloudFromCameraImage.py index 16e85db2d..23fbe302f 100644 --- a/examples/pybullet/examples/pointCloudFromCameraImage.py +++ b/examples/pybullet/examples/pointCloudFromCameraImage.py @@ -73,7 +73,7 @@ imgH = int(height / 10) img = p.getCameraImage(imgW, imgH, renderer=p.ER_BULLET_HARDWARE_OPENGL) rgbBuffer = np.reshape(img[2], (imgH, imgW, 4)) -# Note: this depth buffer's reshaping does not match the [w, h] convention for +# NOTE: this depth buffer's reshaping does not match the [w, h] convention for # OpenGL depth buffers. See getCameraImageTest.py for an OpenGL depth buffer depthBuffer = np.reshape(img[3], [imgH, imgW]) print("rgbBuffer.shape=", rgbBuffer.shape) -- cgit v1.2.1