I don't know how to turn off auto-exposure and auto-focus.

Asked 2 months ago, Updated 2 months ago, 3 views

Currently, I am researching visible light (Li-Fi) using camera2 API on Android Studio.
However, auto-exposure and auto-focus can get in the way when taking pictures of LEDs and retrieving data.

·Automatic exposure
·Autofocus

Please tell me how to cut the above two.

specifications
Android Studio 3.1

Smartphone
SHARP AQUOS API 23
HUAWEIP10 API24

android camera

2022-09-30 11:04

1 Answers

The capture method in CameraCaptureSession takes CameraRequest as the argument.Yes.CameraRequest has various fields, CONTROL_AF_MODE and CONTROL_AE_MODE for autofocus and autofocus.If you set them to OFF, they will be disabled.It also offers CONTROL_MODE that allows you to configure three things together, including white balance adjustments.

createCaptureRequest in CameraDevice allows you to generate CameraRequest.Builder appropriate for each camera, so you should rewrite it to disable AF etc.

Quote Google's sample code (comments made by the citation):

val captureRequest=session.device.createCaptureRequest(
                     CameraDevice.TEMPLATE_STILL_CAPTURE).apply {addTarget(imageReader.surface)}

  // CaptureRequest.set(CONTROL_AF_MODE, OFF) and so on.

session.capture(captureRequest.build(), object: CameraCaptureSession.CaptureCallback(){
  ...


2022-09-30 11:04

If you have any answers or tips


© 2022 OneMinuteCode. All rights reserved.