Skip to content

Commit 6ac404d

Browse files
committed
bug fix
1 parent d0d3b04 commit 6ac404d

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

mujoco_viewer/mujoco_viewer.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -294,13 +294,15 @@ def read_pixels(self, camid=None,depth=False):
294294
# render
295295
mujoco.mjr_render(self.viewport, self.scn, self.ctx)
296296
shape = glfw.get_framebuffer_size(self.window)
297-
img = np.zeros((shape[1], shape[0], 3), dtype=np.float64)
297+
298298

299299
if depth:
300-
depth_img = np.zeros((shape[1], shape[0], 1), dtype=np.uint8)
300+
img = np.zeros((shape[1], shape[0], 3), dtype=np.float64)
301+
depth_img = np.zeros((shape[1], shape[0], 1), dtype=np.float64)
301302
mujoco.mjr_readPixels(img, depth_img, self.viewport, self.ctx)
302-
return np.dstack((np.flipud(img),np.flipud(depth_img)),dtype=np.float64)
303+
return np.dstack((np.flipud(img),np.flipud(depth_img)))
303304
else:
305+
img = np.zeros((shape[1], shape[0], 3), dtype=np.uint8)
304306
mujoco.mjr_readPixels(img, None, self.viewport, self.ctx)
305307
return np.flipud(img)
306308

0 commit comments

Comments
 (0)