'Can camera2 API tell me the difference between the current exposure and the ideal one?
We're building a camera app, and we want to use manual exposure. We don't want the exposure algorithm to set the ISO and exposure duration; instead we want it to tell us what the difference is between the manual exposure that we set and the correct exposure according to the algorithm. That way, we can take this into account in our calculations.
iOS has such an API exposureTargetOffset. Does Android camera2 have such an API?
Solution 1:[1]
I don't think that the camera2 library has such an API. However, you can calculate the difference between your ISO and exposure values, and the algorithmic ones.
Follow the below steps:
- While setting the preview, you put your custom capture callback :
this.previewCaptureSession.setRepeatingRequest(previewSession.build(),
customCaptureCallback, this.cameraHandler);
- In the custom call back you can enquire the ISO and exposure values that the algorithm calculates by looking at the current preview
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);
}
}
- You got the current ISO and exposure, now you can just compare it with the user given ISO and exposure value
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | shubham sharma |