I'm currently working on Androids Camera 2 API and my current problem is, that I cannot set the "CONTROL_AE_EXPOSURE_COMPENSATION".
My code:
-1.0 < exposureAdjustment <1.0
public void setExposure(double exposureAdjustment) {
Range<Integer> range1 = mCameraCharacteristics.get(CameraCharacteristics.CONTROL_AE_COMPENSATION_RANGE);
int minExposure = range1.getLower();
int maxExposure = range1.getUpper();
float newCalculatedValue = 0;
if (exposureAdjustment >= 0) {
newCalculatedValue = (float) (minExposure * exposureAdjustment);
} else {
newCalculatedValue = (float) (maxExposure * -1 * exposureAdjustment);
}
mPreviewRequestBuilder.set(CaptureRequest.CONTROL_AE_EXPOSURE_COMPENSATION, (int) newCalculatedValue);
}
Unfortunately it doesn't work.
I've found a solution, which works for me. Whereby the
exposureAdjustment
parameter is between -1 to +1.Where I build a new
CaptureRequest
via mymPreviewRequestBuilder
(A builder for capture requests) for each exposure adjustment.Here you can find a full Camera2 example.