GearVRf icon indicating copy to clipboard operation
GearVRf copied to clipboard

GVRCameraSceneObject's camera autofocus not working

Open lxc-xx opened this issue 7 years ago • 7 comments

I was working on a project that uses the passthrough camera heavily. Recently I switched the test device from S6 to S7. It seems the autofocus of camera does not work on S7.

The autofocus was working fine on S6. But the same code cannot get the autofocus functionality on S7. On both devices, the passthrough camera from the oculus setting/utilities can do the autofocus, so the hardware is not the problem.

By printing out the camera parameters, I found, on S7, the autofocus parameter cannot be successfully set to 'continuous-video' by the following code, which works on S6. The parameter seems locked to 'auto' params.set("focus-mode", "continuous-video"); camera.setParameters(params);

I tweaked some code in GVRCameraSceneObject and found that if I comment out all camera.setPreviewTexture(mSurfaceTexture); the parameter can be successfully set to 'continuous-video'. But in that case, the preview image will not be rendered.

The test code is from the gearvrf-demo (https://github.com/gearvrf/GearVRf-Demos/tree/master/gvr-sceneobjects)

I have no clue why it happens. Anyone experience the same issue on S7?

Hardware/OS

  1. Galaxy S6/Android 5.0.2
  2. Galaxy S7/Android 6.0.1

lxc-xx avatar Jul 10 '17 03:07 lxc-xx

Hi, I would be curious to know what happens if you use the original GVRCameraSceneObject but in gvr-sceneobjects make the setUpCameraForVrMode(1) call from the Android main/ui thread after 500ms delay for example.

liaxim avatar Jul 10 '17 22:07 liaxim

@lxc-xx Any luck getting the continuous-video mode to work?

liaxim avatar Jul 11 '17 22:07 liaxim

Sorry for late reply. I was working on other stuff these days.

Yes, it works! But 500ms is not long enough, my S7 works with 1000ms. Now it fixes the problem with my project. Do you have any idea why it happens? Seems some task on camera initilization is running in async mode?

lxc-xx avatar Jul 12 '17 13:07 lxc-xx

I think we need to wait for some preview texture-related event. We need to study it more to determine a real fix but at least you have a workaround.

liaxim avatar Jul 12 '17 15:07 liaxim

Definitely!

For now, I suggest keeping this issue open for the reference of other developers?

lxc-xx avatar Jul 13 '17 13:07 lxc-xx

Sure. We have not fixed it.

liaxim avatar Jul 13 '17 14:07 liaxim

@lxc-xx Delay for S7 is ~1s. From my experience camera in android is messed up and you will have to experiment with lots of hacks to make it work on big range of phones :)

felislynx-silae avatar Sep 04 '17 06:09 felislynx-silae