Selecting manual exposure in a CameraX app?

722 views
Skip to first unread message

Keith Matthews

unread,
May 5, 2020, 5:06:31 PM5/5/20
to Android CameraX Discussion Group
Know how I can setup manual exposure, manual focus and manual white balance for my app?

Note: Selecting focus points is not helpful for my peculiar app.

Cheers,
Keith

Keith Matthews

unread,
May 5, 2020, 5:50:23 PM5/5/20
to Android CameraX Discussion Group
Oh... and I never use ImageCapture.  I'm solely doing analysis on preview images.  Where I can find any information about manual exposure settings they are always tied to the ImageCapture use case.  I imagine these wouldn't do me much good, but I could be wrong.

Scott Nien

unread,
May 6, 2020, 12:15:14 AM5/6/20
to Keith Matthews, Android CameraX Discussion Group
Hi Keith, 
We are working to enable this flexibility to applications. Specifically,  there are two items. 
(1) Allows apps to set any 3A related capture request parameters via Camera2Interop,  currently 3A modes are impossible to set by apps. 
(2) Enables apps to dynamically set capture request parameters(also Camera2Interop) to the current repeating request ,   currently only allowed before the use case is bound. 

Hopefully we can release these soon. 


On Wed, May 6, 2020 at 5:50 AM Keith Matthews <ke...@keithdmatthews.com> wrote:
Oh... and I never use ImageCapture.  I'm solely doing analysis on preview images.  Where I can find any information about manual exposure settings they are always tied to the ImageCapture use case.  I imagine these wouldn't do me much good, but I could be wrong.

--
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/e94dd20f-26a9-4801-afff-ee0ccdb357fd%40android.com.

Keith Matthews

unread,
May 6, 2020, 2:59:45 PM5/6/20
to Android CameraX Discussion Group
Do you have an ETA for the release of these new features?

Thanks,
Keith

Vinit Modi

unread,
May 6, 2020, 3:13:25 PM5/6/20
to Keith Matthews, Android CameraX Discussion Group
Hi Keith,

Not yet, will share as we get closer. thanks!

Vinit

--
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.

Keith Matthews

unread,
May 8, 2020, 10:16:06 AM5/8/20
to Android CameraX Discussion Group
Much appreciated.


On Tuesday, May 5, 2020 at 2:06:31 PM UTC-7, Keith Matthews wrote:

Jonathan Goble

unread,
Jun 9, 2020, 12:24:42 PM6/9/20
to Android CameraX Discussion Group, ke...@keithdmatthews.com
Hi,

Has there been any update on this matter? I am working on a unique app for work where manual exposure control is critical. We would like to use CameraX but this is an obstacle we cannot overcome. We really don't want to have to rewrite everything we've done thus far in Camera2.

Like Keith, we're not currently using image capture at all, just image analysis. So we need manual controls to apply to image analysis as well as image capture too.

Thanks.

Vinit Modi

unread,
Jun 9, 2020, 12:33:03 PM6/9/20
to Jonathan Goble, Android CameraX Discussion Group, Keith Matthews
Hi Jonathan,

Given your app's requirements the best approach would be to use camera2. Currently manual control is not on the roadmap for CameraX as we continue to focus on getting a consistent and reliable output across a wide number of Android devices. Thanks!

Vinit

--
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.

Scott Nien

unread,
Jun 9, 2020, 12:36:35 PM6/9/20
to Jonathan Goble, Android CameraX Discussion Group, Keith Matthews
Some updates:  
(1) Allows apps to set any 3A related capture request parameters via Camera2Interop,  currently 3A modes are impossible to set by apps. 
This is supported starting from beta04.    
You can use Camera2Interop to set the any camera2 parameter to the capture requests.   see below usage:

Preview.Builder builder = new Preview.Builder(); 
new Camera2Interop.Extender<>(builder)
   .setCaptureRequestOption( key1,  value1)  
   .setCaptureRequestOption( key2,  value2)  

Preview preview = builder.build();

(2) Enables apps to dynamically set capture request parameters(also Camera2Interop) to the current repeating request ,   currently only allowed before the use case is bound. 

Targeted to release in July . 

--
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.

Jonathan Goble

unread,
Jun 9, 2020, 12:37:57 PM6/9/20
to Android CameraX Discussion Group, jcgo...@gmail.com, ke...@keithdmatthews.com
Vinit,

Alright, thanks for the fast response. Not what I wanted to hear, but it's at least useful to know that manual controls won't be coming anytime soon so we can plan ahead.

Jonathan
To unsubscribe from this group and stop receiving emails from it, send an email to camerax-developers+unsub...@android.com.

Jonathan Goble

unread,
Jun 9, 2020, 12:45:35 PM6/9/20
to Android CameraX Discussion Group, jcgo...@gmail.com, ke...@keithdmatthews.com
Scott,

Actually, that might work for us. Thanks for the information and the example code!

Jonathan
To unsubscribe from this group and stop receiving emails from it, send an email to camerax-developers+unsub...@android.com.

Ramana Reddy

unread,
Jun 26, 2021, 10:21:16 PM6/26/21
to Android CameraX Discussion Group
Scott

is there any update on selecting manual exposure and manual white balance in a CameraX.

Thanks,
Ramana Reddy

Scott Nien

unread,
Jun 27, 2021, 12:43:27 AM6/27/21
to Ramana Reddy, Android CameraX Discussion Group
Hi Ramana, 
Yes,  On the latest 1.0.x or 1.1.x versions, you can use dynamic Camera2Interop API to change AE_MODE / AF_MODE / AWB_MODE to off and set any camera2 parameters you want. 

For example:
         
         Camera camera = cameraProvider.bindToLifecycle(...);
    // Dynamically set AE/AWB to off and set any other camera2 parameters. 
    Camera2CameraControl.from(camera.getCameraControl()).setCaptureRequestOptions(
new CaptureRequestOptions.Builder()
.setCaptureRequestOption(
CaptureRequest.CONTROL_AE_MODE, CaptureRequest.CONTROL_AE_MODE_OFF)
.setCaptureRequestOption(
CaptureRequest.CONTROL_AWB_MODE, CaptureRequest.CONTROL_AWB_MODE_OFF) .setCaptureRequestOption(CaptureRequest.SENSOR_EXPOSURE_TIME, ...) .build()); If you want to set the parameters before the camera opens, you can get the camera instance like the following: // Camera won't open if there are no Preview/ImageCapture/ImageAnalysis being bound.          Camera camera = cameraProvider.bindToLifecycle(lifecycleOwner, cameraSelector);



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/18ae2749-85f9-448c-8467-3909cf6d0f59n%40android.com.

Scott Nien

unread,
Jun 27, 2021, 1:34:00 AM6/27/21
to Ramana Reddy, Android CameraX Discussion Group
In case you also need to access CameraCharacteristics to query the available values for some camera2 parameters, 
please use Camera2CameraInfo API , see samples below:

Camera2CameraInfo camera2CameraInfo = Camera2CameraInfo.from(camera.getCameraInfo());

camera2CameraInfo.getCameraCharacteristic(CameraCharacteristics.CONTROL_AE_AVAILABLE_TARGET_FPS_RANGES);





Ramana Reddy

unread,
Jun 29, 2021, 3:50:26 AM6/29/21
to Android CameraX Discussion Group, Scott Nien, Android CameraX Discussion Group
Scott

Thanks for the information with the example code.
How to get current ISO code from  camera2CameraInfo.getCameraCharacteristic(......)
Can we manually control tint in White Balance using Camera2Interop API ?


Thanks,
Ramana.

Scott Nien

unread,
Jun 29, 2021, 5:45:25 AM6/29/21
to Ramana Reddy, Android CameraX Discussion Group

rollebon marquis

unread,
Aug 4, 2021, 9:10:40 AM8/4/21
to Android CameraX Discussion Group, Scott Nien, Android CameraX Discussion Group, ramanar...@gmail.com
Hi, I've noticed that there might be a problem when using these apis (Camera2CameraControl, Camera2CameraInfo) in some circumstances. For example, if I have multiple fragments within one application who use the cameraX api, lets say that only one of them sets some settings to the camera manually (FragmentA), all the others use the default settings, and if it is possible to go directly from the other camera fragments to FragmentA, then the settings won't be applied. Lets say that all the fragments bind to the camera with their viewLifecycleOwners.

I had a situation like this, and in order to resolve it, I had to use like a listener in fragmentA for when the CameraDevice has been opened, and only then I was able to set some manual settings to CameraX. My assumption was that it's somehow related to multiple fragments using the camerax, and their views not being completely destroyed, therefore camera not being sth(?), before FragmentA sets up the camera. Am I correct in thinking this and was there some other solution that could have worked?

Can someone give me insight about why this problem occurred?

tonyt...@google.com

unread,
Aug 9, 2021, 4:58:12 AM8/9/21
to Android CameraX Discussion Group, rollebon marquis, Scott Nien, Android CameraX Discussion Group, ramanar...@gmail.com
Hi,
Thanks for the question! Could you expand more on this statement "to go directly from the other camera fragments to FragmentA"? I assume it's something like:
1) At FragmentA, set Camera2CameraControl options when some event occurs, maybe a button click.
2) Switch to FragmentB.
3) Switch back to FragmentA. At this point, are you recreating/rebinding the use cases or using the use cases created at step#1?

rollebon marquis

unread,
Aug 9, 2021, 6:44:43 AM8/9/21
to Android CameraX Discussion Group, tonyt...@google.com, rollebon marquis, Scott Nien, Android CameraX Discussion Group, ramanar...@gmail.com
Hi, so in my situation I had this particular fragments in a bottom navigation view.
The steps would be:
1) At fragment A, once I know that camera permissions have been given, and I check if they are given or not in onCreateView(), I unbind all the useCases, setCameraControl before binding any useCase, and then, actually unbind them one more time (I don't think this is of any significance), and then recreate & rebind them. Settings in fragment A were applied.
2) I go to fragmentB. fragmentB goes through step1, just without setting cameraControl.
3) go back to fragment A. onCreateView() is called one more time, I go through step1 one more time: unbind all usecases, setting CameraControl(), unbind all, recreate/and rebind all the usecases. settings in fragment A weren't applied this time.

I am mentioning bottom navigation view, because when I go back to fragmentA in step3, onDestroyView() of fragment B isn't called immediately. onDestroyView() of fragment B is called a little bit later after step 3 for fragmentA finishes. This may be of no importance though.
Reply all
Reply to author
Forward
0 new messages