ARCore를 사용하면 ImageMetadata
를 사용하여 카메라 이미지 캡처 결과의 메타데이터 키 값에 액세스할 수 있습니다. 액세스하고자 하는 일반적인 카메라 이미지 메타데이터 유형에는 초점 거리, 이미지 타임스탬프 데이터, 조명 정보 등이 있습니다.
Android Camera
모듈은 기기의 기능에 따라 캡처된 각 프레임의 이미지에 관한 매개변수를 160개 이상 기록할 수 있습니다. 가능한 모든 메타데이터 키의 목록은 ImageMetadata
를 참고하세요.
개별 메타데이터 키 값 가져오기
getImageMetadata()
를 사용하여 특정 메타데이터 키 값을 가져오고, 사용할 수 없는 경우 MetadataNotFoundException
를 포착합니다. 다음 예에서는 SENSOR_EXPOSURE_TIME
메타데이터 키 값을 얻는 방법을 보여줍니다.
Java
// Obtain the SENSOR_EXPOSURE_TIME metadata value from the frame. Long getSensorExposureTime(Frame frame) { try { // Can throw NotYetAvailableException when sensors data is not yet available. ImageMetadata metadata = frame.getImageMetadata(); // Get the exposure time metadata. Throws MetadataNotFoundException if it's not available. return metadata.getLong(ImageMetadata.SENSOR_EXPOSURE_TIME); } catch (MetadataNotFoundException | NotYetAvailableException exception) { return null; } }
Kotlin
// Obtain the SENSOR_EXPOSURE_TIME metadata value from the frame. fun getSensorExposureTime(frame: Frame): Long? { return runCatching { // Can throw NotYetAvailableException when sensors data is not yet available. val metadata = frame.imageMetadata // Get the exposure time metadata. Throws MetadataNotFoundException if it's not available. return metadata.getLong(ImageMetadata.SENSOR_EXPOSURE_TIME) } .getOrNull() }