Android CameraX. How to change camera parameters after capture start?

Viewed 746

I'm working with Android CameraX API. How do I change camera exposure(CONTROL_AE_REGIONS and CONTROL_AE_EXPOSURE_COMPENSATION parameters)?

I found the usage Camera2Interop.Extender for sending CaptureRequests, but all examples shows how to use it when building camera capture parameters:

    val builder = ImageAnalysis.Builder()
    val camera2InterOp = Camera2Interop.Extender(builder)
    camera2InterOp.setCaptureRequestOption(CaptureRequest.CONTROL_AE_MODE, CameraMetadata.CONTROL_AE_MODE_ON).setCaptureRequestOption(CaptureRequest.CONTROL_AE_EXPOSURE_COMPENSATION, exposure)
    builder.build()

How to control capture parameters after camera start? How to change AE (or may be send camera requests) on the fly?

Thanks.

1 Answers

Both these

https://android-review.googlesource.com/c/platform/frameworks/support/+/1325716

and

https://android-review.googlesource.com/c/platform/frameworks/support/+/1310574

seem to be merged,

Are the changes now available in cameraX.

I want to solve use case of dynamically change camera parameters after start;

Specifically I want to be able to AE LOCK after .build() as below

camera2InterOp.setCaptureRequestOption(CaptureRequest.CONTROL_AE_LOCK, true)    
val builder = imageAnalyzer.setTargetResolution(Size(480, 360)).build()

Any help would be much appreciated

Related