I’m not able to get rgb image from the annotator with multiple cameras.
So far i;ve create the cameras/render_product/annotator in the following way as the examples were suggesting.
self.render_list = []
for i in range(self._num_envs):
camera = rep.create.camera(
position = (self.ws_cx, self.ws_cy , 1.5),
rotation = (0,-90,0),
focal_length = 50,
horizontal_aperture = 90,
clipping_range = (0.1, 1.5+0.5),
parent = "/World/envs/env_"+str(i),
)
self.render_list.append(rep.create.render_product(camera, (640, 480)))
self.rgb = rep.AnnotatorRegistry.get_annotator("rgb")
self.rgb.attach(self.render_list)
print('annotator attached')
However, when i call self.rgb.get_data(), i only obtaining a single image of dimension 640,480 while i was expecting the numpy array to have a different dimension.
Hi there, here is similar example using multiple camera with writers and annotators.
In the current version one needs to create an annotator for each render product. In the example we have a note about this:
# Create render products
rp1 = rep.create.render_product(str(camera_prim1.GetPrimPath()), resolution=(320, 320))
rp2 = rep.create.render_product(str(camera_prim2.GetPrimPath()), resolution=(640, 640))
rp3 = rep.create.render_product("/OmniverseKit_Persp", (1024, 1024))
# Acess the data through annotators
rgb_annotators = []
for rp in [rp1, rp2, rp3]:
rgb = rep.AnnotatorRegistry.get_annotator("rgb")
rgb.attach([rp])
rgb_annotators.append(rgb)
# NOTE A list of render products will be supported in the near future, currently only the first render product in the list will be used
# rgb = rep.AnnotatorRegistry.get_annotator("rgb")
# rgb.attach([rp1, rp2, rp3])
@ahaidu Thank you for the reply, i was also wondering if there is the possibility to stop the annotator to get images and depth information. In the application I’m working on, I just need an image at a certain moment.
Should I create a render_product each time I need the observation of the scene? Is there the possibility to stop the annotator? I have’t found an answer in the documentation
you can use annotator.detach() once the annotator is no longer needed
if the camera and the resolution stays the same, you can (and should – since every new render product will use up the GPU load) re-use the existing render product
currently (in version 2022.2.1) any created render product cannot be destroyed on the fly and will add to the gpu load, this should be fixed in the new release. Creating a new stage will however destroy them and release the free the gpu load.