Topic locked

Check result of FOCUS_MODE_TRIGGERAUTO

June 10, 2014 - 8:36pm #1

Hi,

I have two questions about usage of FOCUS_MODE_TRIGGERAUTO.

  1. Is setFocusMode() a blocking function (e.g. it returns after auto focus is done) ?
  2. How can I know whether auto focus succeeds or not.
    I hope to get the result as the parameter of android.hardware.Camera.AutoFocusCallback
       public static interface AutoFocusCallback {
            void onAutoFocus(boolean b, android.hardware.Camera camera);
       }
    If this is not supported now, is there any plan for it or should I go to the wish list?

 

Note. My test result on Nexus 5 shows

  1. it seems non blocking.
  2. setFocusMode() always returns true, even I put some object very close to the camera and the camera tried auto focus and failed.
boolean result = CameraDevice.getInstance().setFocusMode(
                            CameraDevice.FOCUS_MODE.FOCUS_MODE_TRIGGERAUTO);

Thanks
Jack

Check result of FOCUS_MODE_TRIGGERAUTO

July 7, 2014 - 12:02am #7

fanjack,

when you call

CameraDevice.getInstance().setFocusMode(CameraDevice.FOCUS_MODE.FOCUS_MODE_TRIGGERAUTO)

Vuforia will query the underlying Android camera software layer and will return true if the Android camera software layer responds positively, meaning that the mode is supported; if all is installed correctly on your device (camera driver etc.) the trigger autofocus event should be produced and the camera should actually make an autofocus (note that the TRIGGER_AUTOFOCUS is a "one-shot" autofocus).  Vuforia here relies on what the underlying Android OS / SDK and camera driver installed on your device, so you can assume that generally things will work as expected unless there is a problem at low level (e.g. in the camera driver or the camera Android software layer, on which Vuforia does not have control).

Concerning your onAutofocus() callback support, I guess you mean that you would like to see a Vuforia API that somewhat maps to such native callback. 

At present, there is no plan to support that specific API, but you can post this as a request in our Wish List:

https://developer.vuforia.com/forum/general-discussion/wish-list

 

 

 

Check result of FOCUS_MODE_TRIGGERAUTO

July 6, 2014 - 8:04pm #6

Hi,

Could we get this supported?

Thanks
Jack

Check result of FOCUS_MODE_TRIGGERAUTO

June 18, 2014 - 6:47pm #5

It does not indicate whether the focus operation itself was successful.

This is exactly I hope to have, every time I call 
CameraDevice.getInstance().setFocusMode(CameraDevice.FOCUS_MODE.FOCUS_MODE_TRIGGERAUTO)

Check result of FOCUS_MODE_TRIGGERAUTO

June 18, 2014 - 2:38pm #4

If you are using MonoDevelop, look in the "Plugins/Android/" folder for the AndroidManifest.xml and you will see that it has:

<uses-feature android:name="android.hardware.camera" />

To access Android API Java commands from Unity, you can investigate some of the classes they offer:

http://docs.unity3d.com/ScriptReference/AndroidJavaObject.html

For Vuforia, the SetFocusMode() method of the CameraDevice class returns a boolean indicating whether the focus mode is available and can be activated for that device. It does not indicate whether the focus operation itself was successful.

Check result of FOCUS_MODE_TRIGGERAUTO

June 16, 2014 - 6:45pm #3

Hi Moderator,

Thank you for helping clarify the 1st question.

I have read the Dev-Guide article on Focus Modes for Vuforia.
However I can't find my answer to the 2nd question there.

The problem is I don't have the instance of "android.hardware.Camera", which is returned by open() [link].
I can't call the function autoFocus()  [link] ,
neither the function getParameters() [link].

Please kindly let me know whether there's any specific way to know the result of autofocus with Vuforia SDK.
If you think I can do this by Android SDK, it's appreciated you give more hints.

Thanks
Jack

Check result of FOCUS_MODE_TRIGGERAUTO

June 11, 2014 - 6:32pm #2

Here's a Dev-Guide article on Focus Modes for Vuforia:

https://developer.vuforia.com/resources/dev-guide/continuous-autofocus-and-other-focus-modes

And the Android reference for focus modes:

http://developer.android.com/reference/android/hardware/Camera.Parameters.html

The boolean return value appears to be an indicator of whether the device supports the particular focus mode and once confirmed is returned by setFocusMode() without waiting an arbitrary length of time for the autofocus to complete. Android's focus modes were introduced in different API versions and have varied availability across devices.
 

Topic locked