Start a new topic

Camera Auto Focus in Instant tracking

Camera feed on nearby objects is blur in instant tracking scene in unity. How can I correct that? Phone output is attached.


1 person has this problem

Hi Alexandru,


glad I could help with that. Do you think it is possible to get a Hotfix soon, or some kind of workaround? Because right now I am on a critical project that needs to be shipped by the end of this month and require Wikitude for it. 


Kind regards,

Markus


1 person likes this

I've tried to set the Focus mode to continuous through C# script but there is no change in the output.  

I have exactly the same problem right now. Changing the Focus Mode does absolutely nothing when an Instant Tracker is in the scene. Without it, everything works just fine.


In my scene, I have (like in the example) attached this Method to the OnCameraOpened Event of the WikitudeCamera:

    public void OnCameraOpened()
    {
        camera.FocusMode = CaptureFocusMode.ContinuousAutoFocus;
        Debug.Log($"Camera Focus Mode: {camera.FocusMode.ToString()}");
        Debug.Log($"Continuous Focus Mode Available: {camera.IsFocusModeSupported(CaptureFocusMode.ContinuousAutoFocus)}");
    }

 It logs to the console that The mode of the Camera is now ContinuousAutoFocus and that this Focus mode is supported. However, if I call the exact same method later (i.e from a button click) it logs that the focus mode is not supported.


Is there a way to fix this, because it does not work in the Demo Scenes, either. I am running the App on a Samsung Galaxy Tab Active 2.



Edit: If I uncheck "SMART Enabled" on the InstantTracker the Autofocus does work. Also tested on a Galaxy S9 -> same results

Hi,


If SMART is enabled and you are running on an ARKit or ARCore enabled device, changing the focus options will not work because ARKit / ARCore controls the camera and doesn't offer an API to adjust it.

If SMART is enabled, but you are running on a device that does not support ARKit or ARCore, then the focus options should work. Can you please confirm that this is the issue you are encountering?


Thank you,

Alexandru

Hello,


so if I understand you correctly ARCore should handle the focus?! Well, in combination with Wikitude SMART tracking, it doesn´t (pure ArCore apps do, I just published one and autofocus with ArCore only is working like a charm). 


I did some tests with two devices: Samsung Galaxy S5 (Android 6.0.1, no ArCore) and Samsung Galaxy S9 (Android 9, with ArCore). 

For the tests i used the example Project that comes with the Wikitude SDK (no changes were made in any settings, just Import->Build). Unity Version is 2018.3.11f1.


S5: Autofocus works in "Instant Tracking - Simple" scene. Tracking quality though is horrible (as expected without ArCore).


S9: Autofocus not working in "Instant Tracking - Simple" scene. Tracking quality is good. But because of the super blurry camera image it is basically not usable. 


My Conclusion: Wikitude SMART tracking somehow breaks autofocus of ArCore by either disabling it or setting it to manual focus mode since with pure ArCore it is working. 


Do you have any ideas how to fix this? Can you reproduce the behaviour? 

"ARKit / ARCore controls the camera and doesn't offer an API to adjust it"


So, ArCore does offer an API:

https://developers.google.com/ar/reference/c/group/config#arconfig_setfocusmode

Hi,


My apologies. Last I checked, this was not available. I will forward this to our Android team and hopefully we'll get it fixed soon. Thank you for letting us know.


Best regards,

Alexandru

Login or Signup to post a comment