How to use Burst mode in CameraX like Camera2 API

1,097 views
Skip to first unread message

朱纹凡

unread,
Jun 30, 2019, 9:36:10 PM6/30/19
to Android CameraX Discussion Group
I searched  the relevent api in CameraX but not getting the correct process.Please help me.Thanks

Scott Nien

unread,
Jun 30, 2019, 9:58:30 PM6/30/19
to 朱纹凡, Android CameraX Discussion Group
CameraX does not plan to expose all Camera2 APIs. We would rather add high level API that supports certain useful scenarios.  So can you tell us more about your use case and details? 

On Mon, Jul 1, 2019 at 9:36 AM 朱纹凡 <sakuya...@gmail.com> wrote:
I searched  the relevent api in CameraX but not getting the correct process.Please help me.Thanks

--
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/b8575362-279e-4506-a292-cdeea0541e9a%40android.com.

Sakuya

unread,
Jul 1, 2019, 9:14:37 PM7/1/19
to Android CameraX Discussion Group, sakuya...@gmail.com

Thank you for your reply, I want to take 6 photos at a time, but at present I can't think of other methods besides getting the picture of each frame.

在 2019年7月1日星期一 UTC+8上午9:58:30,Scott Nien写道:
CameraX does not plan to expose all Camera2 APIs. We would rather add high level API that supports certain useful scenarios.  So can you tell us more about your use case and details? 

On Mon, Jul 1, 2019 at 9:36 AM 朱纹凡 <sakuya...@gmail.com> wrote:
I searched  the relevent api in CameraX but not getting the correct process.Please help me.Thanks

--
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-developers+unsub...@android.com.

Scott Nien

unread,
Jul 1, 2019, 10:43:50 PM7/1/19
to Sakuya, Android CameraX Discussion Group
More details will be helpful . 
What do you want to do after getting the 6 photos ?   Are these 6 photos taken with the same request options Or you want each request has different option ?  

On Tue, Jul 2, 2019 at 9:14 AM Sakuya <sakuya...@gmail.com> wrote:

Thank you for your reply, I want to take 6 photos at a time, but at present I can't think of other methods besides getting the picture of each frame.

在 2019年7月1日星期一 UTC+8上午9:58:30,Scott Nien写道:
CameraX does not plan to expose all Camera2 APIs. We would rather add high level API that supports certain useful scenarios.  So can you tell us more about your use case and details? 

On Mon, Jul 1, 2019 at 9:36 AM 朱纹凡 <sakuya...@gmail.com> wrote:
I searched  the relevent api in CameraX but not getting the correct process.Please help me.Thanks

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

--
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/e2ec1d2e-e791-4277-9441-9a6c45515a28%40android.com.

Sakuya

unread,
Jul 2, 2019, 10:37:16 PM7/2/19
to Android CameraX Discussion Group, sakuya...@gmail.com
Our app will take six photos quickly and choose the best photos for glamorous processing.
CaptureBurst can be used in Cmaera2, but I upgraded to AndroidX using CameraX. I don't know how to do it.

在 2019年7月2日星期二 UTC+8上午10:43:50,Scott Nien写道:
More details will be helpful . 
What do you want to do after getting the 6 photos ?   Are these 6 photos taken with the same request options Or you want each request has different option ?  

On Tue, Jul 2, 2019 at 9:14 AM Sakuya <sakuya...@gmail.com> wrote:

Thank you for your reply, I want to take 6 photos at a time, but at present I can't think of other methods besides getting the picture of each frame.

在 2019年7月1日星期一 UTC+8上午9:58:30,Scott Nien写道:
CameraX does not plan to expose all Camera2 APIs. We would rather add high level API that supports certain useful scenarios.  So can you tell us more about your use case and details? 

On Mon, Jul 1, 2019 at 9:36 AM 朱纹凡 <sakuya...@gmail.com> wrote:
I searched  the relevent api in CameraX but not getting the correct process.Please help me.Thanks

--
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-developers+unsub...@android.com.

--
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-developers+unsub...@android.com.

Scott Nien

unread,
Jul 2, 2019, 10:53:08 PM7/2/19
to Sakuya, Android CameraX Discussion Group
Unfortunately CameraX does not allow taking continuous shots for now. We do have a plan to support advanced features like this but no guaranteed schedule. 
Thanks for letting us know your use case. 

On Wed, Jul 3, 2019 at 10:37 AM Sakuya <sakuya...@gmail.com> wrote:
Our app will take six photos quickly and choose the best photos for glamorous processing.
CaptureBurst can be used in Cmaera2, but I upgraded to AndroidX using CameraX. I don't know how to do it.

在 2019年7月2日星期二 UTC+8上午10:43:50,Scott Nien写道:
More details will be helpful . 
What do you want to do after getting the 6 photos ?   Are these 6 photos taken with the same request options Or you want each request has different option ?  

On Tue, Jul 2, 2019 at 9:14 AM Sakuya <sakuya...@gmail.com> wrote:

Thank you for your reply, I want to take 6 photos at a time, but at present I can't think of other methods besides getting the picture of each frame.

在 2019年7月1日星期一 UTC+8上午9:58:30,Scott Nien写道:
CameraX does not plan to expose all Camera2 APIs. We would rather add high level API that supports certain useful scenarios.  So can you tell us more about your use case and details? 

On Mon, Jul 1, 2019 at 9:36 AM 朱纹凡 <sakuya...@gmail.com> wrote:
I searched  the relevent api in CameraX but not getting the correct process.Please help me.Thanks

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

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

--
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/0d19c5d6-1117-417a-af2b-67a2baf81c1c%40android.com.

Sakuya

unread,
Jul 2, 2019, 11:00:44 PM7/2/19
to Android CameraX Discussion Group, sakuya...@gmail.com
Thank you for your reply and look forward to the arrival of this day.

在 2019年7月3日星期三 UTC+8上午10:53:08,Scott Nien写道:
Unfortunately CameraX does not allow taking continuous shots for now. We do have a plan to support advanced features like this but no guaranteed schedule. 
Thanks for letting us know your use case. 

On Wed, Jul 3, 2019 at 10:37 AM Sakuya <sakuya...@gmail.com> wrote:
Our app will take six photos quickly and choose the best photos for glamorous processing.
CaptureBurst can be used in Cmaera2, but I upgraded to AndroidX using CameraX. I don't know how to do it.

在 2019年7月2日星期二 UTC+8上午10:43:50,Scott Nien写道:
More details will be helpful . 
What do you want to do after getting the 6 photos ?   Are these 6 photos taken with the same request options Or you want each request has different option ?  

On Tue, Jul 2, 2019 at 9:14 AM Sakuya <sakuya...@gmail.com> wrote:

Thank you for your reply, I want to take 6 photos at a time, but at present I can't think of other methods besides getting the picture of each frame.

在 2019年7月1日星期一 UTC+8上午9:58:30,Scott Nien写道:
CameraX does not plan to expose all Camera2 APIs. We would rather add high level API that supports certain useful scenarios.  So can you tell us more about your use case and details? 

On Mon, Jul 1, 2019 at 9:36 AM 朱纹凡 <sakuya...@gmail.com> wrote:
I searched  the relevent api in CameraX but not getting the correct process.Please help me.Thanks

--
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-developers+unsub...@android.com.

--
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-developers+unsub...@android.com.

--
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-developers+unsub...@android.com.

Christian Günther

unread,
Oct 19, 2021, 9:00:12 AM10/19/21
to Android CameraX Discussion Group, Sakuya
Sorry for necrobump this discussion, but is there any progress of providing capture bursts?

Android CameraX Discussion Group

unread,
Oct 21, 2021, 2:00:06 AM10/21/21
to Android CameraX Discussion Group, christian...@authentic.network, Sakuya
Thank you so much for reaching out again! This feature is in our pipeline, unfortunately, we don't have a public schedule for this feature now.

Philipp Puehringer

unread,
Mar 17, 2022, 5:48:27 PM3/17/22
to Android CameraX Discussion Group, Android CameraX Discussion Group
I'm trying to build a FocusStacking app. For that i would need to take a series of images at different focal distances while displaying a preview. Is such task possible with CameraX and if so what would be the easiest way to impletment?
I've also heard about captureBurst from Camera2 Api this would fit my needs well, but my progress would need to be rewriten with Camera2 instead of CameraX.

Sorry for my bad english, Kind Regards from Austria,
Philipp

tonyt...@google.com

unread,
Mar 21, 2022, 5:36:32 AM3/21/22
to Android CameraX Discussion Group, philipp.p...@gmail.com, Android CameraX Discussion Group
Does the latency between each capture matter for your application? If so, capture burst approach is recommended. Although it will still take some time for the focus to converge.

On the other hand, the CameraX approach may be submitting the captures repeatedly and using Camera2CameraControl API in between to apply different focal distance. Note that the specified focal distance will also affect the preview.

Philipp Puehringer

unread,
Mar 21, 2022, 6:11:40 AM3/21/22
to Android CameraX Discussion Group, tonyt...@google.com, Philipp Puehringer, Android CameraX Discussion Group
thanks for your reply, latenzy does not really matter, but the faster the better.

that second approach is the way i would like to take. when changing settings like focus do i have to rebind my usecases between each frame that gets captured? or when is the best time to change those settings with the Camera2CameraController?

tonyt...@google.com

unread,
Mar 22, 2022, 12:46:20 AM3/22/22
to Android CameraX Discussion Group, philipp.p...@gmail.com, tonyt...@google.com, Android CameraX Discussion Group
No it doesn't have to be rebound. By using Camera2CameraControl, the capture request options are dynamically applied to all use cases that are bound to the camera. So you may change the focus settings after receiving the previous capture success callback, then wait for the future returned by setCaptureRequestOptions to complete, then capture the next image. Beware that by changing the focus related settings, it may interfere with the focus feature provided by CameraX and cause unexpected behavior when used together.

Philipp Puehringer

unread,
Mar 22, 2022, 7:20:29 AM3/22/22
to Android CameraX Discussion Group, tonyt...@google.com, Philipp Puehringer, Android CameraX Discussion Group
this helped me already a lot setting focus is implemented and i got the Callback to know if a image save working.

imageCapture!!.takePicture(
    outputOptions, cameraExecutor, object : ImageCapture.OnImageSavedCallback
      {override fun onImageSaved(output: ImageCapture.OutputFileResults)
         {val savedUri = output.savedUri ?: Uri.fromFile(photoFile)
          Log.d(TAG, "Photo capture succeeded: $savedUri")
          }
      })


var captureRequestOptions = CaptureRequestOptions.Builder()
.setCaptureRequestOption(CaptureRequest.CONTROL_AF_MODE, CameraMetadata.CONTROL_AF_MODE_OFF)
.setCaptureRequestOption(CaptureRequest.LENS_FOCUS_DISTANCE, distance).build()
Camera2CameraControl.from(camera!!.cameraControl).captureRequestOptions  =
captureRequestOptions

unfortunatly I dont know how to get that future object returned from setCaptureRequestOprions. Can you please give me some hints how to do this task. i would be grateful.

Kind regards

tonyt...@google.com

unread,
Mar 22, 2022, 11:10:40 AM3/22/22
to Android CameraX Discussion Group, philipp.p...@gmail.com, tonyt...@google.com, Android CameraX Discussion Group
setCaptureRequestOptions returns a ListenableFuture, which can be used to monitor the execution result. Here is a guide and you may want to add a callback to start the next capture after the capture request options has been successfully applied.

Philipp Puehringer

unread,
Mar 22, 2022, 12:14:03 PM3/22/22
to Android CameraX Discussion Group, tonyt...@google.com, Philipp Puehringer, Android CameraX Discussion Group
i have created that callback as follows:

var listenableFuture = Camera2CameraControl.from(camera!!.cameraControl).setCaptureRequestOptions(captureRequestOptions)
Futures.addCallback(listenableFuture,object : FutureCallback<Void> {
override fun onSuccess(result: Void?) {
Log.d(TAG, "Focus set!")
}

override fun onFailure(t: Throwable?) {
Log.e(TAG, "Failed setting Focus ${t!!.message}")
}
},context!!.mainExecutor)

and it is giving me an that error message:
Failed setting Focus Camera2CameraControl was updated with new options.

Eventhough it is setting the focus. what am i doing wrong?

Philipp Puehringer

unread,
Mar 22, 2022, 1:16:15 PM3/22/22
to Android CameraX Discussion Group, Philipp Puehringer, tonyt...@google.com, Android CameraX Discussion Group
Never mind, got it working now. thank you so much for helping out.
by the way CameraX is by far the easiest API  to use. The implementet methodes work like a dream (e.g.setLinearZoom(float)). love it.
please keep on adding. my personal favorit would be a focus controll and a burst mode as you can already gues:)
Reply all
Reply to author
Forward
0 new messages