Camera Image Capture

Rendering an image through any of these cameras involves two steps:

  1. Use the `getImages` API: Use the getImages API to retrieve images from the desired camera, specifying the types of images (e.g., RGB, Depth). This API returns a list of images along with their associated camera poses.

For example, to retrieve RGB and Depth perspective images from the front center camera (assuming the AirGen client has been set up):

# Retrieve both Scene (RGB) and Depth images from the front center camera
image_data = client.getImages(
    "front_center",
    [airgen.ImageType.Scene, airgen.ImageType.DepthPerspective]
)

The image_data is a list of tuples where each tuple contains an image and the corresponding camera pose at the time the image was captured.

  1. Parse the Response and Extract Images: The image_data list contains multiple entries based on the requested image types. Each entry consists of the actual image and the camera pose at the time of capture.

Extracting and Visualizing the RGB Image:

You can extract the first image (RGB) and visualize it using the rerun library as follows:

# Extract the first image, which is the RGB image, and the camera's pose
rgb_image, camera_pose = image_data[0]

# Visualize the RGB image using Rerun
import rerun as rr
rr.log("image", rr.Image(rgb_image))
Example RGB Output

Warning

AirGen returns the images in RGB ordering, but OpenCV uses BGR ordering. So, you may need to reverse the channel order if you wish to use these images with OpenCV.

Extracting and Visualizing the Depth Image:

Similarly, you can extract and visualize the depth image using the rerun.DepthImage wrapper:

# Extract the second image, which is the Depth image, and the camera's pose
depth_image, camera_pose = image_data[1]

# Visualize the Depth image using Rerun
import rerun as rr
rr.log("image", rr.DepthImage(depth_image))
Example Depth Output