Google is committed to advancing racial equity for Black communities. See how.

Camera image metadata

ARCore lets you use ArImageMetadata to access metadata key values from the camera image capture result. Some common types of camera image metadata you might want to access are focal length, image timestamp data, or lighting information.

The Android Camera module can record 160 or more parameters about the image for each frame captured, depending on a device's capabilities. For a list of all possible metadata keys, see the NDK Camera documentation.

Get the value of an individual metadata tag

Use ArImageMetadata_getConstEntry() to get a specific metadata tag value. The following example shows obtaining the ACAMERA_SENSOR_EXPOSURE_TIME metadata value:

ArSession_update(session, frame);

// Obtain the metadata object from the frame.
ArImageMetadata* ar_metadata;
ArFrame_acquireImageMetadata(session, frame, &ar_metadata);

// Get the exposure time metadata (using ACAMERA_SENSOR_EXPOSURE_TIME in this
// example).
ArImageMetadata_const_entry exposure_entry;
ArImageMetadata_getConstEntry(session, ar_metadata,
                              ACAMERA_SENSOR_EXPOSURE_TIME, &exposure_entry);

Get a list of all metadata tags for a given frame

Use ArImageMetadata_getAllKeys() to get a list of all metadata keys captured for a given frame.

ArSession_update(session, frame);

// Obtain the metadata object from the frame.
ArImageMetadata* ar_metadata;
ArFrame_acquireImageMetadata(session, frame, &ar_metadata);

// Obtain the list of all the metadata for a given frame.
const uint32_t* all_tags = NULL;
int32_t number_of_tags = -1;

ArImageMetadata_getAllKeys(session, ar_metadata, &number_of_tags, &all_tags);