Camera X Exposure and Focus Control

1,219 views
Skip to first unread message
Assigned to scot...@google.com by wuj...@google.com

Michael Bramley

unread,
Jan 25, 2021, 2:31:23 PM1/25/21
to camerax-d...@android.com
Hi,

I am investigating the functionality of CameraX and am trying to find out
if there is a way to manually control turning  AutoFcus and AutoExposure off/on.

I am looking to stop the camera from updating the autoexposure and autofocus on the images that are coming into the Analysis callback. So that if the lighting changes the camera will not react and the image that come into the Analysis callback will for instance be either brighter or darker than the correct exposure.

Thank you,
mike

Scott Nien

unread,
Jan 25, 2021, 11:26:23 PM1/25/21
to Michael Bramley, Android CameraX Discussion Group
Turning off AE/AF might not be a good approach because the quality may become unacceptable.  

If you want to lock the AE/AF.   suggest to use the following camera2 interop API to set CONTROL_AE_LOCK for locking AE,  and set CONTROL_AF_MODE to CONTROL_AF_MODE_AUTO to prevent from performing AF continuously. 

if (shouldLockAeAf) {
Camera2CameraControl.from(cameraControl).setCaptureRequestOptions(
new CaptureRequestOptions.Builder()
.setCaptureRequestOption(CaptureRequest.CONTROL_AE_LOCK, true)
.setCaptureRequestOption(CaptureRequest.CONTROL_AF_MODE,
CaptureRequest.CONTROL_AF_MODE_AUTO).build());
} else { // you might need to check if CONTROL_AF_MODE_CONTINUOUS_PICTURE is supported on device or not.
Camera2CameraControl.from(cameraControl).setCaptureRequestOptions(
new CaptureRequestOptions.Builder()
.setCaptureRequestOption(CaptureRequest.CONTROL_AE_LOCK, false)
.setCaptureRequestOption(CaptureRequest.CONTROL_AF_MODE,
CaptureRequest.CONTROL_AF_MODE_CONTINUOUS_PICTURE).build());
   
}




--
You received this message because you are subscribed to the Google Groups "Android CameraX Discussion Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to camerax-develop...@android.com.
To view this discussion on the web visit https://groups.google.com/a/android.com/d/msgid/camerax-developers/CAJ-WKN-uvsA-0_eRhEmiEzuB5HadRoRRc3ynTUikFUJ%2BzWmB6g%40mail.gmail.com.
Reply all
Reply to author
Forward
0 new messages