I have a CameraX-App and I'm trying to change the gamma value of the pictures I take. Since CameraX doesn't support that, I have to use the Camera2Interop class to use Camera2 functionality.
It should be relatively easy to change the gamma value and there is nothing to do wrong, but for some reason it's just not changing my gamma value. The Preview and pictures I take never change at all.
The relevant code is very simple:
ImageCapture.Builder builder = new ImageCapture.Builder();
Camera2Interop.Extender<ImageCapture> extender = new Camera2Interop.Extender<>(builder);
extender.setCaptureRequestOption(CaptureRequest.TONEMAP_MODE, CaptureRequest.TONEMAP_MODE_GAMMA_VALUE);
extender.setCaptureRequestOption(CaptureRequest.TONEMAP_GAMMA, 0.1f);
ImageCapture imageCapture = builder.build();
I tried all types of float values for gamma but never noticed any change. I tried it with multiple devices (new and old devices) from multiple brands. Gamma never changed.
It works when i do:
extender.setCaptureRequestOption(CaptureRequest.TONEMAP_MODE, CameraMetadata.TONEMAP_MODE_CONTRAST_CURVE); extender.setCaptureRequestOption(CaptureRequest.TONEMAP_CURVE, tonemapCurve);
Or with other tonemap modes I've tried, but not gamma. It is very important that it works that way though. Does anyone have any ideas on how to make it work?
I've found a similar question to mine (I think) but unfortunately without answers: Android Camera2 API contrast/gamma is not working for video preview
I showed above what I tried and what I've expected.