कैमरा इमेज मेटाडेटा

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()
}