Camera image metadata
Stay organized with collections
Save and categorize content based on your preferences.
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.
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);
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);
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-10-31 UTC.
[null,null,["Last updated 2024-10-31 UTC."],[[["\u003cp\u003eARCore's \u003ccode\u003eArImageMetadata\u003c/code\u003e allows access to camera image metadata like focal length, timestamps, and lighting information.\u003c/p\u003e\n"],["\u003cp\u003eDevelopers can retrieve specific metadata values, such as exposure time, using \u003ccode\u003eArImageMetadata_getConstEntry()\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eArImageMetadata_getAllKeys()\u003c/code\u003e provides a list of all metadata tags available for a given frame.\u003c/p\u003e\n"],["\u003cp\u003eThe Android \u003ccode\u003eCamera\u003c/code\u003e module can record extensive image parameters, with a full list available in the NDK documentation.\u003c/p\u003e\n"]]],[],null,["# Camera image metadata\n\nARCore lets you use [`ArImageMetadata`](/ar/reference/c/group/ar-image-metadata)\nto access metadata key values from the camera image capture result. Some\ncommon types of camera image metadata you might want to access are focal length,\nimage timestamp data, or lighting information.\n\nThe Android `Camera` module can record 160 or more parameters about the image\nfor each frame captured, depending on a device's capabilities. For a list of all\npossible metadata keys, see the [NDK `Camera` documentation](https://developer.android.com/ndk/reference/group/camera).\n\nGet the value of an individual metadata tag\n-------------------------------------------\n\nUse [`ArImageMetadata_getConstEntry()`](/ar/reference/c/group/ar-image-metadata#arimagemetadata_getconstentry)\nto get a specific metadata tag value. The following example shows obtaining the `ACAMERA_SENSOR_EXPOSURE_TIME` metadata value: \n\n```c\nArSession_update(session, frame);\n\n// Obtain the metadata object from the frame.\nArImageMetadata* ar_metadata;\nArFrame_acquireImageMetadata(session, frame, &ar_metadata);\n\n// Get the exposure time metadata (using ACAMERA_SENSOR_EXPOSURE_TIME in this\n// example).\nArImageMetadata_const_entry exposure_entry;\nArImageMetadata_getConstEntry(session, ar_metadata,\n ACAMERA_SENSOR_EXPOSURE_TIME, &exposure_entry);\n```\n\nGet a list of all metadata tags for a given frame\n-------------------------------------------------\n\nUse [`ArImageMetadata_getAllKeys()`](/ar/reference/c/group/ar-image-metadata#arimagemetadata_getallkeys) to get a list of all metadata keys captured\nfor a given frame. \n\n```c\nArSession_update(session, frame);\n\n// Obtain the metadata object from the frame.\nArImageMetadata* ar_metadata;\nArFrame_acquireImageMetadata(session, frame, &ar_metadata);\n\n// Obtain the list of all the metadata for a given frame.\nconst uint32_t* all_tags = NULL;\nint32_t number_of_tags = -1;\n\nArImageMetadata_getAllKeys(session, ar_metadata, &number_of_tags, &all_tags);\n```"]]