Autofocus too slow and wrong point of focus

234 views
Skip to first unread message

Henrique S.G.C

unread,
Jun 14, 2022, 10:06:34 AM6/14/22
to Android CameraX Discussion Group
We are trying to capture a video of the finger using CameraX but autofocus is a bit slow and sometimes it focuses on the wrong part of the frame  (not on the finger center), making the finger image blurred. We need a sharp image of the finger and a fast focus.
Any suggestions ?

Scott Nien

unread,
Jun 14, 2022, 10:56:06 PM6/14/22
to Henrique S.G.C, Android CameraX Discussion Group
Hi, 
Can you share how you get the MeteringPointFactory instance ? If you use PreviewView,  it is recommended to use PreviewView.getMeteringPointFactory as it takes the display orientation and the scale mode into consideration. 

Regarding the slow focus,  can you share what device you were using ?  

Scott 

On Tue, Jun 14, 2022 at 10:06 PM Henrique S.G.C <hsgc...@gmail.com> wrote:
We are trying to capture a video of the finger using CameraX but autofocus is a bit slow and sometimes it focuses on the wrong part of the frame  (not on the finger center), making the finger image blurred. We need a sharp image of the finger and a fast focus.
Any suggestions ?

--
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/6b140336-b5fa-46fb-9c8a-682272a56acfn%40android.com.

Scott Nien

unread,
Jun 14, 2022, 11:44:19 PM6/14/22
to Henrique S.G.C, Android CameraX Discussion Group
Hi, 

Regarding the wrong focus points issue,  can you verify if this only happens when video capture is bound ?  We doubt that some cropping might happen in HAL implicitly during video recording and cause this issue. 

For the slow focus,  we think it is probably by design.  During video recording,  the AF mode is switched to CONTROL_AF_MODE_CONTINUOUS_VIDEO which does mention "The focusing behavior should be suitable for good quality video recording; typically this means slower focus movement and no overshoots."   Do you think the slow focus will be an issue during video recording ?  


Henrique S.G.C

unread,
Jun 15, 2022, 10:19:25 AM6/15/22
to Android CameraX Discussion Group, Scott Nien, Android CameraX Discussion Group, Henrique S.G.C
Hi Scott, thanks for your message. 
Please find (image attached) the code we are using.
We are running it on a Samsung A01 modelb8a56f32-1e72-47ae-a809-0c92407807e3.jpg

Henrique S.G.C

unread,
Jun 15, 2022, 10:27:12 AM6/15/22
to Android CameraX Discussion Group, Scott Nien, Android CameraX Discussion Group, Henrique S.G.C
What do you mean by bound video capture ? Limited to a Region of Interest (ROI)?
If this is the case, we started with no ROI and it didn't work well (Slow), now we are trying to limit the focus to the finger center. 
Slow focus may be a concern because: 1) the user tends to move the finger ;2) If it's too long or gets impatient and press the button to record it even if it's not well focused.

Henrique S.G.C

unread,
Jun 15, 2022, 10:30:33 AM6/15/22
to Android CameraX Discussion Group, Scott Nien, Android CameraX Discussion Group, Henrique S.G.C
Just to add some more information, we are auto-focusing  BEFORE we start to record.

Em quarta-feira, 15 de junho de 2022 às 00:44:19 UTC-3, Scott Nien escreveu:

Scott Nien

unread,
Jun 17, 2022, 3:10:58 AM6/17/22
to Henrique S.G.C, Android CameraX Discussion Group
Hi 
What I mean is ,  you can remove the VideoCapture from the bindToLifecycle() and then observe if the focus time is quicker.  
I don't think we can help with the slow focus issue as this is implemented in OEMs. 

For the wrong focus object issue,  what is the (x, y)  used for creating MeteringPoint ?  Are you trying to focus on the center point of the preview ? 

Message has been deleted

Henrique S.G.C

unread,
Jun 20, 2022, 9:15:53 AM6/20/22
to Android CameraX Discussion Group, Scott Nien, Android CameraX Discussion Group, Henrique S.G.C
We are testing the use of four metering points around the image center. We also tested using a region around the center (didn´t work well).
I've read that autofocus is based on contrast measurement, can this be changed? We found that sharpness measurement is more reliable 
than contrast to evaluate focus.

Regarding the slow focus, one of the reasons for it is that camera first focuses on some object, based on the background (a texture for example), and is slow to change focus (to the finger) when we place the finger on the image. It gets stuck on the background for a while.

Scott Nien

unread,
Jun 20, 2022, 10:17:33 AM6/20/22
to Henrique S.G.C, Android CameraX Discussion Group
> I've read that autofocus is based on contrast measurement, can this be changed? We found that sharpness measurement is more reliable than contrast to evaluate focus.
This is unable to change.  CameraX startFocusAndMetering API simply calls camera2 APIs so it still relies on OEM implementation on the AF features.   

On Mon, Jun 20, 2022 at 9:09 PM Henrique S.G.C <hsgc...@gmail.com> wrote:
We are using testing the use of four metering points around the image center. We also tested using a region around the center (didn´t work well).
I've read that autofocus is based on contrast measurement, can this be changed? We found that sharpness measurement is more reliable than contrast to evaluate focus.

Regarding the slow focus, one of the reasons for it is that camera first focuses on some object, based on the background (a texture for example), and is slow to change focus (to the finger) when we place the finger on the image. It gets stuck on the background for a while.

Em sexta-feira, 17 de junho de 2022 às 04:10:58 UTC-3, Scott Nien escreveu:
Reply all
Reply to author
Forward
0 new messages