public interface

ExposureState

 androidx.camera.core.ExposureState

Gradle dependencies

compile group: 'androidx.camera', name: 'camera-core', version: '1.2.0-alpha01'

  • groupId: androidx.camera
  • artifactId: camera-core
  • version: 1.2.0-alpha01

Artifact androidx.camera:camera-core:1.2.0-alpha01 it located at Google repository (https://maven.google.com/)

Overview

An interface which contains the camera exposure related information.

Applications can retrieve an instance via CameraInfo.getExposureState().

Summary

Methods
public intgetExposureCompensationIndex()

Get the current exposure compensation index.

public <any>getExposureCompensationRange()

Get the maximum and minimum exposure compensation values for CameraControl.setExposureCompensationIndex(int)

public RationalgetExposureCompensationStep()

Get the smallest step by which the exposure compensation can be changed.

public booleanisExposureCompensationSupported()

Whether exposure compensation is supported for this camera.

Methods

public int getExposureCompensationIndex()

Get the current exposure compensation index.

The exposure value (EV) is the compensation index multiplied by the step value which is given by ExposureState.getExposureCompensationStep(). Increasing the compensation index by using the CameraControl.setExposureCompensationIndex(int) will increase exposure making the capture result brighter, decreasing the value making it darker.

For example, if the exposure value (EV) step size is 0.333, set the exposure compensation index value '6' will mean an exposure compensation of +2 EV; -3 will mean an exposure compensation of -1 EV.

The exposure value resets to default when there is no UseCase associated with the camera. For example, unbind all use cases from the camera or when the lifecycle changed that all the use case stopping data from the camera.

Returns:

The current exposure compensation index. If ExposureState.isExposureCompensationSupported() is false, always return 0.

See also: CameraControl.setExposureCompensationIndex(int)

public <any> getExposureCompensationRange()

Get the maximum and minimum exposure compensation values for CameraControl.setExposureCompensationIndex(int)

The actual exposure value (EV) range that supported by the camera can be calculated by multiplying the ExposureState.getExposureCompensationStep() with the maximum and minimum values:

Min.exposure compensation * ExposureState.getExposureCompensationStep() <= minimum supported EV

Max.exposure compensation * ExposureState.getExposureCompensationStep() >= maximum supported EV

Returns:

the maximum and minimum exposure compensation values range. If ExposureState.isExposureCompensationSupported() is false, return Range [0,0].

See also:

public Rational getExposureCompensationStep()

Get the smallest step by which the exposure compensation can be changed.

Returns:

The exposure compensation step. If ExposureState.isExposureCompensationSupported() is false, return .

See also:

public boolean isExposureCompensationSupported()

Whether exposure compensation is supported for this camera.

Returns:

true if exposure compensation is supported for this camera.

Source

/*
 * Copyright 2020 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package androidx.camera.core;

import android.util.Range;
import android.util.Rational;

import androidx.annotation.NonNull;
import androidx.annotation.RequiresApi;

/**
 * An interface which contains the camera exposure related information.
 *
 * <p>Applications can retrieve an instance via {@link CameraInfo#getExposureState()}.
 */
@RequiresApi(21) // TODO(b/200306659): Remove and replace with annotation on package-info.java
public interface ExposureState {

    /**
     * Get the current exposure compensation index.
     *
     * <p>The exposure value (EV) is the compensation index multiplied by the step value
     * which is given by {@link #getExposureCompensationStep()}. Increasing the compensation
     * index by using the {@link CameraControl#setExposureCompensationIndex} will increase
     * exposure making the capture result brighter, decreasing the value making it darker.
     * <p>For example, if the exposure value (EV) step size is 0.333, set the exposure compensation
     * index value '6' will mean an exposure compensation of +2 EV; -3 will mean an exposure
     * compensation of -1 EV.
     * <p>The exposure value resets to default when there is no {@link UseCase} associated with
     * the camera. For example, unbind all use cases from the camera or when the lifecycle
     * changed that all the use case stopping data from the camera.
     *
     * @return The current exposure compensation index. If {@link
     * #isExposureCompensationSupported()} is false, always return 0.
     * @see CameraControl#setExposureCompensationIndex
     */
    int getExposureCompensationIndex();

    /**
     * Get the maximum and minimum exposure compensation values for
     * {@link CameraControl#setExposureCompensationIndex}
     *
     * <p>The actual exposure value (EV) range that supported by the camera can be calculated by
     * multiplying the {@link #getExposureCompensationStep()} with the maximum and minimum values:
     * <p><code>Min.exposure compensation * {@link #getExposureCompensationStep()} &lt;= minimum
     * supported EV</code>
     * <p><code>Max.exposure compensation * {@link #getExposureCompensationStep()} &gt;= maximum
     * supported EV</code>
     *
     * @return the maximum and minimum exposure compensation values range. If {@link
     * #isExposureCompensationSupported()} is false, return Range [0,0].
     * @see android.hardware.camera2.CameraCharacteristics#CONTROL_AE_COMPENSATION_RANGE
     */
    @NonNull
    Range<Integer> getExposureCompensationRange();

    /**
     * Get the smallest step by which the exposure compensation can be changed.
     *
     * @return The exposure compensation step. If {@link
     * #isExposureCompensationSupported()} is false, return {@link Rational#ZERO}.
     * @see android.hardware.camera2.CameraCharacteristics#CONTROL_AE_COMPENSATION_STEP
     */
    @NonNull
    Rational getExposureCompensationStep();

    /**
     * Whether exposure compensation is supported for this camera.
     *
     * @return true if exposure compensation is supported for this camera.
     */
    boolean isExposureCompensationSupported();
}