Since this hasn't clear answer, and stackoverflow hasn't questions / answers about Camera 2 API Gamma, I ask for solution to modify Brightness, Contrast and Gamma using Android Camera 2 API.
My code to get range and step:
Rational controlAECompensationStep = characteristics.get(CameraCharacteristics.CONTROL_AE_COMPENSATION_STEP);
if (controlAECompensationStep != null) {
compensationStep = controlAECompensationStep.doubleValue();
}
Range<Integer> controlAECompensationRange = characteristics.get(CameraCharacteristics.CONTROL_AE_COMPENSATION_RANGE);
if (controlAECompensationRange != null) {
minCompensationRange = controlAECompensationRange.getLower();
maxCompensationRange = controlAECompensationRange.getUpper();
}
My method to set Brightness in percents:
public void setBrightness(int value) {
int brightness = (int) (minCompensationRange + (maxCompensationRange - minCompensationRange) * (value / 100f));
previewRequestBuilder.set(CaptureRequest.CONTROL_AE_EXPOSURE_COMPENSATION, brightness);
applySettings();
}
private void applySettings() {
try {
captureSession.setRepeatingRequest(previewRequestBuilder.build(), null, null);
} catch (Exception e) {
e.printStackTrace();
}
}
But this approach doesn't work correctly. Image becomes green, like here.
I described all what I found in documentation.