Metadane zdjęcia w aparacie
Zadbaj o dobrą organizację dzięki kolekcji
Zapisuj i kategoryzuj treści zgodnie ze swoimi preferencjami.
ARCore pozwala używać ArImageMetadata
aby uzyskać dostęp do par klucz-wartość metadanych z wyniku przechwytywania obrazu aparatu. Niektóre
typ metadanych obrazu z aparatu, z których warto skorzystać, to
ogniskowa,
sygnaturze czasowej czy informacjami o oświetleniu.
Moduł Camera
na Androidzie może rejestrować co najmniej 160 parametrów obrazu
dla każdej przechwyconej klatki, w zależności od możliwości urządzenia. Lista wszystkich
możliwe klucze metadanych znajdziesz w dokumentacji NDK Camera
.
Użyj formatu ArImageMetadata_getConstEntry()
aby uzyskać określoną wartość tagu metadanych. Poniższy przykład pokazuje uzyskiwanie wartości metadanych ACAMERA_SENSOR_EXPOSURE_TIME
:
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);
Użyj usługi ArImageMetadata_getAllKeys()
, aby uzyskać listę wszystkich przechwyconych kluczy metadanych
dla danej klatki.
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);
O ile nie stwierdzono inaczej, treść tej strony jest objęta licencją Creative Commons – uznanie autorstwa 4.0, a fragmenty kodu są dostępne na licencji Apache 2.0. Szczegółowe informacje na ten temat zawierają zasady dotyczące witryny Google Developers. Java jest zastrzeżonym znakiem towarowym firmy Oracle i jej podmiotów stowarzyszonych.
Ostatnia aktualizacja: 2025-07-26 UTC.
[null,null,["Ostatnia aktualizacja: 2025-07-26 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```"]]