Manual focus with flash using Android2 camera

How to perform manual (touch) focus with flash using an Android2 api camera?

My captureRequest settings are: 1. type - TEMPLATE_PREVIEW 2. CONTROL_AE_MODE - CONTROL_AE_MODE_OFF 3. FLASH_MODE - FLASH_MODE_SINGLE 4. CONTROL_AF_TRIGGER - CONTROL_AF_TRIGGER_START

using:

CaptureSession.capture(captureRequest.build(), captureCallback, null);

Result: The camera focuses if there is enough light. Otherwise, the flash blinks very quickly and the focus does not fire.

+4
source share
1 answer

You can try to perform manual (touch) focus with the flash in this way:

mPreviewBuilder.set(CaptureRequest.CONTROL_AE_MODE, CameraMetadata.CONTROL_AE_MODE_ON_AUTO_FLASH);

when using TRIGGER, use both AE and AF:

mPreviewBuilder.set(CaptureRequest.CONTROL_AF_TRIGGER, CameraMetadata.CONTROL_AF_TRIGGER_CANCEL);
mPreviewBuilder.set(CaptureRequest.CONTROL_AF_TRIGGER, CameraMetadata.CONTROL_AF_TRIGGER_START);
mPreviewBuilder.set(CaptureRequest.CONTROL_AE_PRECAPTURE_TRIGGER, CameraMetadata.CONTROL_AE_PRECAPTURE_TRIGGER_START);

and then:

mCameraCaptureSession.setRepeatingRequest(mPreviewBuilder.build(), mPreviewSessionCallback, mHandler);
+2
source

Source: https://habr.com/ru/post/1568717/


All Articles