ARCore consente di utilizzare ArImageMetadata
per accedere alle coppie chiave-valore dei metadati dal risultato dell'acquisizione dell'immagine della fotocamera. Alcuni tipi comuni di metadati dell'immagine della fotocamera a cui potresti voler accedere sono la lunghezza focale, i dati del timestamp dell'immagine o le informazioni sull'illuminazione.
Il modulo Camera
di Android può registrare 160 o più parametri sull'immagine per ogni frame acquisito, a seconda delle funzionalità del dispositivo. Per un elenco di tutte le possibili chiavi di metadati, consulta la documentazione di NDK Camera
.
Ottenere il valore di un singolo tag di metadati
Utilizza ArImageMetadata_getConstEntry()
per ottenere un valore specifico del tag dei metadati. Nell'esempio seguente viene illustrato come ottenere il valore dei metadati 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);
Ottieni un elenco di tutti i tag dei metadati per un determinato frame
Utilizza ArImageMetadata_getAllKeys()
per ottenere un elenco di tutte le chiavi dei metadati acquisite per un determinato 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);