Skip to content

Commit

Permalink
Merge pull request bulletphysics#4116 from jamesbraza/fixing-imaging-…
Browse files Browse the repository at this point in the history
…examples

Fixing pybullet example on getting a point cloud
  • Loading branch information
erwincoumans authored Jan 12, 2022
2 parents dc72081 + 51a5aa8 commit 478da74
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions examples/pybullet/examples/getCameraImageTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
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)
Expand Down
6 changes: 4 additions & 2 deletions examples/pybullet/examples/pointCloudFromCameraImage.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,10 @@ def getRayFromTo(mouseX, mouseY):
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))
# 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)

Expand Down

0 comments on commit 478da74

Please sign in to comment.