How to get depth image in Isaac sim

The version I used is 4.0.0, and I used the following code to try to get the depth image, but it failed. How to get depth image?

self._camera = scene.add(Camera(
            prim_path="/World/camera1",
            name="camera1",
            position=self.camera_position,
            frequency=20,
            resolution=(256, 256),
            orientation=rot_utils.euler_angles_to_quats(np.array([0, 20, 180]), degrees=True), 
        ))
self._camera.initialize()
...

self._camera.add_motion_vectors_to_frame()
self._camera.add_distance_to_camera_to_frame()
...
self._camera.get_data() # error 'Camera' object has no attribute 'get_data'
self._camera.get_depth() # return None

setup the depth annotator

you can find more information on the depth annotator here:

https://docs.omniverse.nvidia.com/extensions/latest/ext_replicator/annotators_details.html

thank you! I solved the problem using the following code.

self._camera.add_distance_to_camera_to_frame()
...
self._camera.get_current_frame()["distance_to_camera"]
1 Like

Well done!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.