sceneform-android icon indicating copy to clipboard operation
sceneform-android copied to clipboard

config.setFocusMode

Open zygoh1986 opened this issue 3 years ago • 6 comments

I am trying to get my google pixel 4a rear camera to auto focus on the marker.

I am not able to focus till i onPause and return to the app. The auto focus works perfectly well.

May i know why didn't it auto focus when i first initiate the camera?

Thanks in advance!

zygoh1986 avatar Oct 13 '21 08:10 zygoh1986

If possible, please attach the Video you showed me

RGregat avatar Oct 13 '21 08:10 RGregat

Sure. Please see attached video. https://user-images.githubusercontent.com/69612872/137099811-644805a6-c64d-42e4-a026-6a4fc98affa3.MOV

zygoh1986 avatar Oct 13 '21 08:10 zygoh1986

I had the same issue. Try to call session.resume() in onSessionConfiguration. This works for me:

override fun onSessionConfiguration(session: Session?, config: Config?) {

    if (session?.isDepthModeSupported(Config.DepthMode.AUTOMATIC) == true) {
         config?.depthMode = Config.DepthMode.AUTOMATIC
     }

     config?.focusMode = Config.FocusMode.AUTO

     session?.configure(config)
     session?.resume()
}

In general the auto focus is not really reliable with sceneform. Somethimes you have to wait a few seconds and move your camera back and forth to get the focus on an object. Does anybody know optimizations to get a faster and more reliable focus?

MarcoGoe avatar Oct 15 '21 09:10 MarcoGoe

This sounds more like an ARCore issue.

Can you create an issue on the ARCore repo to have more infos about how the autofocus should be configured ?

ThomasGorisse avatar Oct 15 '21 09:10 ThomasGorisse

The FocusMode.AUTO is already set by default before the session?.resume() but there seems to have an issue when the 2 calls or done without waits.

ThomasGorisse avatar Oct 15 '21 09:10 ThomasGorisse

Yes. This bug was there when we did ARCore samples, in several device models.

A dirty-hack we did was to start an empty activity and finish it immediately 😉

monsterbrain avatar Oct 25 '21 08:10 monsterbrain

Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar Aug 18 '23 05:08 github-actions[bot]

Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please feel free to create a new issue with up-to-date information.

github-actions[bot] avatar Aug 25 '23 05:08 github-actions[bot]