ARCore 可讓您使用 ArImageMetadata
從相機拍照結果存取中繼資料鍵值。您可能會想存取的常見相機圖片中繼資料類型包括焦距、圖片時間戳記資料或光照資訊。
Android Camera
模組可以為每個擷取的影格記錄 160 個以上的圖片參數 (視裝置功能而定)。如需所有可能的中繼資料鍵清單,請參閱 NDK Camera
說明文件。
取得個別中繼資料標記的值
使用 ArImageMetadata_getConstEntry()
取得特定中繼資料標記值。以下範例說明如何取得 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);
取得指定影格的所有中繼資料標記清單
使用 ArImageMetadata_getAllKeys()
取得特定影格擷取的所有中繼資料鍵清單。
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);