Siêu dữ liệu hình ảnh của máy ảnh

ARCore cho phép bạn sử dụng ArImageMetadata để truy cập vào các giá trị khoá siêu dữ liệu từ kết quả chụp ảnh của máy ảnh. Một số loại siêu dữ liệu hình ảnh máy ảnh phổ biến mà bạn có thể muốn truy cập là tiêu cự, dữ liệu dấu thời gian của hình ảnh hoặc thông tin về độ sáng.

Mô-đun Camera của Android có thể ghi lại 160 thông số trở lên về hình ảnh cho mỗi khung hình đã chụp, tuỳ thuộc vào khả năng của thiết bị. Để biết danh sách tất cả khoá siêu dữ liệu có thể có, hãy xem tài liệu Camera về NDK.

Nhận giá trị của từng thẻ siêu dữ liệu

Sử dụng ArImageMetadata_getConstEntry() để nhận giá trị thẻ siêu dữ liệu cụ thể. Ví dụ sau đây minh hoạ cách lấy giá trị siêu dữ liệu 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);

Lấy danh sách tất cả các thẻ siêu dữ liệu cho một khung cụ thể

Sử dụng ArImageMetadata_getAllKeys() để xem danh sách tất cả các khoá siêu dữ liệu được chụp cho một khung hình cụ thể.

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);