Skip to main content

Image Code Snippets

In this section, we introduce the Python/C++ API to access and manipulate Project Aria images (projectaria_tools/main/core/image). Raw Aria data is stored in VRS files.

Raw sensor data

Raw image data is stored in ImageData. ImageData is a type alias of an std::pair. The two components of that pair are:

  1. The image frame stored in vrs::PixelFrame class (potentially compressed)
    • We recommend that users do not directly use PixelFrame
  2. Image data records
    • Image acquisition information such as timestamps, exposure and gain
from projectaria_tools.core import data_provider, image
from projectaria_tools.core.stream_id import StreamId

vrsfile = "example.vrs"
provider = data_provider.create_vrs_data_provider(vrsfile)

stream_id = provider.get_stream_id_from_label("camera-slam-left")
image_data = provider.get_image_data_by_index(stream_id, 0)
pixel_frame = image_data[0].pixel_frame

Manipulating images

In Python, we provide an interface for converting from ImageData into numpy arrays.

image_array = image_data[0].to_numpy_array()