camera2 API可以告诉我当前曝光量与理想曝光量之间的区别吗?

Vad*_*ick 5 shutter android-camera2 exposure exposure-time

我们正在构建一个相机应用,我们想使用手动曝光。我们不希望曝光算法设置ISO和曝光时间;取而代之的是,我们希望它告诉我们我们设置的手动曝光与根据算法得出的正确曝光之间的区别。这样,我们可以在计算中考虑到这一点。

iOS具有这样的API ExposureTargetOffset。Android camera2是否有这样的API?

shu*_*rma 1

我不认为camera2库有这样的API。但是,您可以计算 ISO 和曝光值以及算法值之间的差异。

请按照以下步骤操作:

  1. 设置预览时,您可以放置​​自定义捕获回调:
    this.previewCaptureSession.setRepeatingRequest(previewSession.build(),
              customCaptureCallback, this.cameraHandler);
Run Code Online (Sandbox Code Playgroud)
  1. 在自定义回调中,您可以通过查看当前预览来查询算法计算出的 ISO 和曝光值
CameraCaptureSession.CaptureCallback customCaptureCallback = new CameraCaptureSession.CaptureCallback() {
  @Override
      public void onCaptureCompleted(@NonNull CameraCaptureSession session,
                                     @NonNull CaptureRequest request,
                                     @NonNull TotalCaptureResult result) {
        super.onCaptureCompleted(session, request, result);

        //you can store the values of these two below variables however you want

        final Long exposureValue = result.get(CaptureResult.SENSOR_EXPOSURE_TIME);
        final Integer isoValue = result.get(CaptureResult.SENSOR_SENSITIVITY);
      }
}
Run Code Online (Sandbox Code Playgroud)
  1. 您获得了当前的 ISO 和曝光值,现在您可以将其与用户给定的 ISO 和曝光值进行比较