1

I'm using Camera2 API to modify Camera shutter speed.

So I have to set CONTROL_AE_MODE to AE_MODE_OFF.

Then auto-exposure algorithm will not override SENSOR_SENSITIVITY value.

But after shutter speed changed, sensitivity value become not suitable. the preview become too dark or white.

My question is: How to change SENSOR_SENSITIVITY (ISO value) automatically when AE_MODE is OFF.

I know in iOS camera, they have exposureTargetOffset value to decide whether iso value suitable.

But I have not found in android camera2 api.

Any suggestion will be appreciated.

jrbedard
  • 3,662
  • 5
  • 30
  • 34
yujinyang
  • 11
  • 1
  • 5

3 Answers3

3

There's no semi-automatic mode in camera2 currently; if you turn off auto-exposure, you have to manually control both exposure and sensitivity.

You can leave AE on, and use exposure compensation to darken/brighten the images instead.

Eddy Talvala
  • 17,243
  • 2
  • 42
  • 47
2

The SENSOR_EXPOSURE_TIME and SENSOR_SENSITIVITY can both be changed when AE Mode is off. The ranges of these settings may vary and can be requested by respectively SENSOR_INFO_EXPOSURE_TIME_RANGE and SENSOR_INFO_SENSITIVITY_RANGE. Note that this is not possible on all phones!

You can take a look at the Open Camera project as a great example for changing these values.

Hibbem
  • 1,491
  • 15
  • 22
0

In case anyone else wants an answer to this If you're using camera2 API in CameraCaptureSession.CaptureCallback.onCaptureCompleted you can get the current autoexposure time and iso sensitivity. This gets called for every preview frame. So you can run your preview with auto exposure on, and each time you get a preview frame save exposure multiplied by ISO

mExposureTimesISO=(double)(result.get(TotalCaptureResult.SENSOR_SENSITIVITY)*result.get(TotalCaptureResult.SENSOR_EXPOSURE_TIME));

Then in your picture taking call set it to manual exposure, then divide this value by your desired ISO, e.g. in my ISO 100 locked image capture routine it looks like the below:

double exposureAtISO100=mExposureTimesISO/100.0;            
CaptureRequest.Builder build=mCamera.createCaptureRequest(CameraDevice.TEMPLATE_STILL_CAPTURE);

build.set(CaptureRequest.CONTROL_AE_MODE,CaptureRequest.CONTROL_AE_MODE_OFF);
build.set(CaptureRequest.SENSOR_SENSITIVITY,100);
build.set(CaptureRequest.SENSOR_EXPOSURE_TIME,(long)exposureAtISO100);