Why does the focusing method force the removal of AWB that has been manually set?

100 views
Skip to first unread message

yihao wu

unread,
Nov 22, 2022, 5:11:57 AM11/22/22
to Android CameraX Discussion Group
I set AWB, but after calling the focus method, the AWB I set is invalid. Why?

yihao wu

unread,
Nov 22, 2022, 5:29:26 AM11/22/22
to Android CameraX Discussion Group, yihao wu
11111.jpeg
Hello, I have a question, why is it set to automatic every time?

Scott Nien

unread,
Nov 22, 2022, 10:30:21 AM11/22/22
to yihao wu, Android CameraX Discussion Group
Hi Yihao, 

If your app sets the capture request parameters via Camera2Interop or Camera2CameraControl,  it should have higher priority than what CameraX sets. 
The CONTROL_AWB_MODE is always set even when focus is not called.  

Are you trying to set AWB_MODE to something other than AUTO via Camera2Interop or Camera2CameraControl ? 



--
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/6c72181d-61f1-450c-86cc-76ffba1f9d8cn%40android.com.

yihao wu

unread,
Nov 23, 2022, 1:42:47 AM11/23/22
to Android CameraX Discussion Group, scot...@google.com, Android CameraX Discussion Group, yihao wu
Thank you. I have tried to set up awb. This is the way I use it. I just tried to set awb before focusing back, and I found that it will still be cleared. Can you try it? I suspect my setting has been overwritten.

cameraController?.cameraControl?.let { control ->
Camera2CameraControl.from(control).addCaptureRequestOptions(
CaptureRequestOptions.Builder()
.setCaptureRequestOption(CaptureRequest.CONTROL_AWB_MODE, awbMode.value)
.build()
)

Scott Nien

unread,
Nov 24, 2022, 4:25:30 AM11/24/22
to yihao wu, Android CameraX Discussion Group
I confirmed it will override the value set in CameraX. 

Would it be possible that your device doesn't support the AWB mode that you set via Camera2CameraControl so it stays in AUTO ?  
Can you also check the value in CaptureRequest instead of TotalCaptureResult to see if the parameter is correct ?  

yihao wu

unread,
Nov 24, 2022, 10:46:32 PM11/24/22
to Android CameraX Discussion Group, scot...@google.com, Android CameraX Discussion Group, yihao wu

My device is supported, because our app has an entrance to set awb, and the preview will be effective after I set it up。
Does it have anything to do with priority?
For example, I set up awb, but your code will change my setting to automatic.
It seems to me that the code does not get the current awb, but directly sets the awb supported by the device.

Scott Nien

unread,
Nov 24, 2022, 10:57:00 PM11/24/22
to yihao wu, Android CameraX Discussion Group
What is the CameraX version that you were using ?  

yihao wu

unread,
Nov 24, 2022, 11:03:51 PM11/24/22
to Android CameraX Discussion Group, scot...@google.com, Android CameraX Discussion Group, yihao wu
1.2.0-alpha03

yihao wu

unread,
Nov 28, 2022, 3:41:43 AM11/28/22
to Android CameraX Discussion Group, scot...@google.com, Android CameraX Discussion Group, yihao wu
Hello, will this happen to you? Does the upgraded version work?

在2022年11月25日星期五 UTC+8 11:57:00<scot...@google.com> 写道:

Scott Nien

unread,
Nov 28, 2022, 11:41:50 PM11/28/22
to yihao wu, Android CameraX Discussion Group
Setting AWB_MODE works for me using 1.2.0-alpha3 on CameraXBasic on Pixel 5. 

We probably need more code snippets to debug. 

yihao wu

unread,
Nov 29, 2022, 1:38:12 AM11/29/22
to Android CameraX Discussion Group, scot...@google.com, Android CameraX Discussion Group, yihao wu
Can you show me your code?
I set the AWB before focusing, and then the AWB is reset. Thank you.

Scott Nien

unread,
Nov 29, 2022, 2:23:31 AM11/29/22
to yihao wu, Android CameraX Discussion Group
Please see sample codes below:
camera = cameraProvider.bindToLifecycle(
this, cameraSelector, preview, imageCapture, imageAnalyzer)

Camera2CameraControl.from(camera!!.cameraControl)
.addCaptureRequestOptions(
androidx.camera.camera2.interop.CaptureRequestOptions.Builder()
.setCaptureRequestOption(
android.hardware.camera2.CaptureRequest.CONTROL_AWB_MODE,
android.hardware.camera2.CaptureRequest.CONTROL_AWB_MODE_DAYLIGHT
)
.build()
)

yihao wu

unread,
Nov 29, 2022, 3:37:19 AM11/29/22
to Android CameraX Discussion Group, scot...@google.com, Android CameraX Discussion Group, yihao wu

I see that your code is similar to mine, and then you will focus after you set up AWB. Is AWB still there?

Scott Nien

unread,
Nov 29, 2022, 10:48:09 PM11/29/22
to yihao wu, Android CameraX Discussion Group
Yes,  after tap-to-focus (cameraControl#startFocusAndMetering),  the AWB mode is still there. 

yihao wu

unread,
Nov 29, 2022, 11:07:46 PM11/29/22
to Android CameraX Discussion Group, scot...@google.com, Android CameraX Discussion Group, yihao wu
Thank you. It's no problem for me to try it with demo myself. I think I should continue to see what's wrong with my project.
Message has been deleted

Scott Nien

unread,
Dec 1, 2022, 10:17:33 AM12/1/22
to yihao wu, Android CameraX Discussion Group
Not sure what went wrong.  The only difference between addCaptureRequestOptions and setCaptureRequestOptions is that setCaptureRequestOptions will clear the existing options first while addCaptureRequestOptions won't. 

On Wed, Nov 30, 2022 at 6:19 PM yihao wu <wuy...@insta360.com> wrote:
I found the problem. I used addCaptureRequestOptions instead of setCaptureRequestOptions.

在2022年11月30日星期三 UTC+8 11:48:09<scot...@google.com> 写道:
Reply all
Reply to author
Forward
0 new messages