Exposure indicator#

The exposure indicator gives the current camera shutter speed and iso sensitivity. For Camera2, it also gives information on current exposure lock region.

These values may change very often in automatic exposure mode.

Camera 1#

For drones supporting Camera1 API, exposure values are monitored with a separated instrument: Instruments.cameraExposureValues.

Sample code to monitor exposure indicator:

/** Reference on CameraExposureValues instrument. */
private var exposureValuesRef: Ref<CameraExposureValues>? = null

/** Monitors and prints exposure values. */
fun monitorExposureValues(drone: Drone) {
    exposureValuesRef = drone.getInstrument(CameraExposureValues::class.java) { exposureValues ->
        // called on main thread when the instrument changes
        exposureValues?.run {
            println("Shutter speed: $shutterSpeed")
            println("Iso sensitivity: $isoSensitivity")
        }
    }
}

Example of output:

Shutter speed: ONE_OVER_10000
Iso sensitivity: ISO_50

Camera 2#

Exposure values are monitored with sub-component Camera.ExposureIndicator.

Sample code to monitor exposure indicator:

/** Reference on MainCamera peripheral. */
private var cameraRef: Ref<MainCamera>? = null
/** `MainCamera` peripheral. This is used to know when peripheral appears. */
private var mainCamera: Camera? = null

/** Monitors and prints exposure indicator. */
fun monitorExposureIndicator(drone: Drone) {
    cameraRef = drone.getPeripheral(MainCamera::class.java) { camera ->
        // called on main thread when the camera peripheral changes
        camera?.run {
            // register sub-component listener, only when camera peripheral appears
            if (mainCamera == null) {
                // get notified every time exposure indicator sub-component changes
                camera.component<Camera.ExposureIndicator> { exposureIndicator ->
                    exposureIndicator?.run {
                        println("Shutter speed: $shutterSpeed")
                        println("Iso sensitivity: $isoSensitivity")
                        println("Lock region: $lockRegion")
                    }
                }
            }
        }
        mainCamera = camera
    }
}

Example of output:

Shutter speed value: ONE_OVER_30
Iso sensitivity value: ISO_1600
Lock region: LockRegion(centerX=0.0, centerY=0.0, width=1.0, height=1.0)