Set White Balance, ISO, Aperture & Shutter Speed with Night Mode and Exposure using CameraX and Camera2

1,322 views
Skip to first unread message

Mohammad Sajib Al Seraj

unread,
Mar 14, 2022, 4:52:40 PM3/14/22
to Android CameraX Discussion Group

I'm trying to set the camera preview White Balance, ISO, Aperture & Shutter Speed with Night Mode and Exposure settings for my app. I have set night mode and exposure setting using CameraX, and figured out settings option for rest of the settings using Camera 2. How can I use CameraX and Camera2 at the same time for camera preview?

Thanks in advance!

Wenhung Teng

unread,
Mar 15, 2022, 5:56:07 AM3/15/22
to Android CameraX Discussion Group, Mohammad Sajib Al Seraj
Hi, using camera2 and cameraX at the same time may grab the camera resource for each other.

Can you share some more detail about the scene that you still require the camera2 API?
Ideally, CameraX would be able to set the camera2 control options to the camera via https://developer.android.com/reference/androidx/camera/camera2/interop/Camera2CameraControl
It can help to set the parameter to all the output streams just similar to use camera2 API directly (please check the camera characteristic from https://developer.android.com/reference/androidx/camera/camera2/interop/Camera2CameraInfo before using it)
Mohammad Sajib Al Seraj 在 2022年3月15日 星期二上午4:52:40 [UTC+8] 的信中寫道:

Mohammad Sajib Al Seraj

unread,
Mar 15, 2022, 4:28:51 PM3/15/22
to Wenhung Teng, Android CameraX Discussion Group
I need to set values for  White Balance, ISO, Aperture & Shutter Speed. Camera2CameraControl helps me to set those values.

Thanks & Regards
Mohammad

Eino-Ville Talvala

unread,
Mar 15, 2022, 4:36:33 PM3/15/22
to Mohammad Sajib Al Seraj, Wenhung Teng, Android CameraX Discussion Group
Unfortunately, you can't both get precise camera control and use an extension like Night Mode.  When you turn on Night Mode, the camera control is largely taken over by the extension, and fine-grain control isn't possible.

That's because the way something like Night Mode works may be very complicated (take long bursts of images that are merged, run alternative focusing/white balancing algorithms, and so on) and not uniform from device to device.
So there's no reliable way to adjust capture parameters like there would be with normal camera operation. That said, we are looking at supporting basic settings like zoom in the future.

- Eddy

--
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/CAHDOb3kho6f6N_HbO45O1VSGkfxbeeMbkzp-DPBebkxMtCuYPg%40mail.gmail.com.

Mohammad Sajib Al Seraj

unread,
Mar 15, 2022, 4:49:43 PM3/15/22
to Eino-Ville Talvala, Wenhung Teng, Android CameraX Discussion Group
Thanks for your explanation. 

Mohammad Sajib Al Seraj

unread,
Apr 6, 2022, 4:39:10 PM4/6/22
to Android CameraX Discussion Group, Mohammad Sajib Al Seraj, wenhu...@google.com, Android CameraX Discussion Group, Eino-Ville Talvala

How can I change white balance manually? I have tried to set using  Camera2CameraControl and get Kelvin value from MetaData (Example: use CameraMetadata.CONTROL_AWB_MODE_CLOUDY_DAYLIGHT when Kelvin value in between 6000 and 7000 ).

Camera2CameraControl.from(camera.getCameraControl()).setCaptureRequestOptions(new CaptureRequestOptions.Builder()
.setCaptureRequestOption(CaptureRequest.CONTROL_AWB_MODE, wbValue) // wbValue is Kelvin value 
.build());

It changes the camera settings, but I am not getting expected result. Any suggestion?

Thanks
Mohammad 
Reply all
Reply to author
Forward
0 new messages