Open x18-1 opened 2 months ago
I change the code to:
result = p.getCameraImage(
width=self.intrinsic.width,
height=self.intrinsic.height,
viewMatrix=gl_view_matrix,
projectionMatrix=self.gl_proj_matrix,
renderer=p.ER_BULLET_HARDWARE_OPENGL,
physicsClientId=client
)
rgb = np.reshape(result[2], [self.intrinsic.height, self.intrinsic.width, 4])[:,:,:3]
rgb = rgb.astype(np.uint8)
# print(rgb[0])
z_buffer = np.reshape(result[3], [self.intrinsic.height, self.intrinsic.width])
z_buffer = z_buffer.astype(np.uint8)
# rgb, z_buffer = np.ascontiguousarray(result[2][:, :, :3]), result[3]
depth = (
1.0 * self.far * self.near / (self.far - (self.far - self.near) * z_buffer)
)
depth = depth.astype(np.float32)
it worked
Hi, thanks for your feedback. In this repo we use pybullet==3.2.6 with numpy enabled, and the function getCameraImage
returns numpy arrays. Maybe your installed pybullet is not numpy enabled? You could check this via running:
python -c "import pybullet; print('NumPy enabled:', pybullet.isNumpyEnabled())"
Anyway, we have modified the code in cns/utils/perception.py to cope with this condition.
When i run
demo_sim_Erender.py
,I got the wrong:I have print the result[2],it's a tuple。 I dont’t konw how to solve it.