我正在尝试使用Camera2 API捕获具有特定曝光时间的图像。 将其设置为较小的值(例如1/8000秒或1/10)时,一切看起来都很好。 问题出在我尝试将其设置为5秒或30之类的值时,即使SENSOR_INFO_EXPOSURE_TIME_RANGE是:
from 13181 to 48369980540(48 seconds).
当我从CaptureResult获取曝光时间时,我得到的是我输入的值,而不是真实的曝光时间。
我知道我的相机可以以更高的曝光度拍摄照片,因为我的相机限制为30秒。
那是我尝试的代码:
final CaptureRequest.Builder captureBuilder =
mCameraDevice.createCaptureRequest(CameraDevice.TEMPLATE_STILL_CAPTURE);
captureBuilder.addTarget(mImageReader.getSurface());
captureBuilder.set(CaptureRequest.CONTROL_AE_MODE, CaptureRequest.CONTROL_AE_MODE_OFF);
captureBuilder.set(CaptureRequest.SENSOR_SENSITIVITY, 100);
captureBuilder.set(CaptureRequest.SENSOR_EXPOSURE_TIME, 10000000000L);//10 seconds
// Orientation
int rotation = activity.getWindowManager().getDefaultDisplay().getRotation();
captureBuilder.set(CaptureRequest.JPEG_ORIENTATION, getOrientation(rotation));
CameraCaptureSession.CaptureCallback CaptureCallback
= new CameraCaptureSession.CaptureCallback() {
@Override
public void onCaptureCompleted(@NonNull CameraCaptureSession session,
@NonNull CaptureRequest request,
@NonNull TotalCaptureResult result) {
showToast("Saved: " + mFile);
Log.d(TAG, mFile.toString());
Long expo = result.get(CaptureResult.SENSOR_EXPOSURE_TIME);
unlockFocus();
}
};
mCaptureSession.stopRepeating();
mCaptureSession.abortCaptures();
mCaptureSession.capture(captureBuilder.build(), CaptureCallback, null);