How to manually control ISO in CameraX?

111 views
Skip to first unread message
Assigned to wenhu...@google.com by wuj...@google.com

Nikola Stankovic

unread,
Mar 30, 2023, 5:10:05 PM3/30/23
to Android CameraX Discussion Group
Is it possible to control the ISO from CameraX, or must the Camera2 API be accessed? I want to set the ISO value 50.

Wenhung Teng

unread,
Apr 12, 2023, 6:10:53 AM4/12/23
to Android CameraX Discussion Group, nikola.st...@gmail.com
Hi, You can use the Camera2Interop API to set the manual mode options to the camera.
The Camera2Interop API may override the settings from CameraX library, please reference the developer document to control the camera.

Some sample code may looks like:
```
            val provider = ProcessCameraProvider.getInstance(requireContext()).await()
            val camera = provider.bindToLifecycle(
                viewLifecycleOwner,
                CameraSelector.DEFAULT_BACK_CAMERA,
                preview,
                analysis,
                capture
            )
            camera.setISO()
```

```
    private suspend fun Camera.setISO() {
        val control = Camera2CameraControl.from(cameraControl)

        control.setCaptureRequestOptions(CaptureRequestOptions.Builder().apply {

            setCaptureRequestOption(CaptureRequest.CONTROL_AE_MODE, CameraMetadata.CONTROL_AE_MODE_OFF)
            setCaptureRequestOption(CaptureRequest.SENSOR_SENSITIVITY, 50)

        }.build()).await()
    }
```

nikola.st...@gmail.com 在 2023年3月31日 星期五清晨5:10:05 [UTC+8] 的信中寫道:
Reply all
Reply to author
Forward
0 new messages