google-ar / arcore-unity-sdk

ARCore SDK for Unity
https://developers.google.com/ar
Other
1.4k stars 402 forks source link

[Bug] Cannot AcquireCameraImageBytes in v1.10.0 and newer (v1.10, v1.11, v1.12, v1.13) #676

Open d-lay opened 4 years ago

d-lay commented 4 years ago

I use the HelloAR Example Scene and the only thing I changed is within the code of HelloARController.cs. In the Update Method. I added the following lines of code directly after _UpdateApplicationLifecycle();

if (Frame.CameraImage.Texture == null) { return; }

using (var image = Frame.CameraImage.AcquireCameraImageBytes()) { if (!image.IsAvailable) { Debug.Log("Not available"); return; } Debug.Log("Available"); } When I use Frame.CameraImage.AcquireCameraImageBytes() I get the following Error in Instantrun:

EntryPointNotFoundException: AImage_getPlaneData GoogleARCoreInternal.ImageApi.GetImageBuffer (System.IntPtr imageHandle, System.Int32& width, System.Int32& height, System.IntPtr& yPlane, System.IntPtr& uPlane, System.IntPtr& vPlane, System.Int32& yRowStride, System.Int32& uvPixelStride, System.Int32& uvRowStride) (at Assets/GoogleARCore/SDK/Scripts/Api/Wrappers/ImageApi.cs:55) GoogleARCore.CameraImageBytes..ctor (System.IntPtr imageHandle) (at Assets/GoogleARCore/SDK/Scripts/CameraImageBytes.cs:43) GoogleARCoreInternal.FrameApi.AcquireCameraImageBytes () (at Assets/GoogleARCore/SDK/Scripts/Api/Wrappers/FrameApi.cs:80) GoogleARCore.Frame+CameraImage.AcquireCameraImageBytes () (at Assets/GoogleARCore/SDK/Scripts/Frame.cs:618) GoogleARCore.Examples.HelloAR.HelloARController.Update () (at Assets/GoogleARCore/Examples/HelloAR/Scripts/HelloARController.cs:93)

And the following Warning:

Failed to acquire camera image with status ErrorNotYetAvailable. UnityEngine.Debug:LogWarningFormat(String, Object[]) GoogleARCoreInternal.FrameApi:AcquireCameraImageBytes() (at Assets/GoogleARCore/SDK/Scripts/Api/Wrappers/FrameApi.cs:76) GoogleARCore.CameraImage:AcquireCameraImageBytes() (at Assets/GoogleARCore/SDK/Scripts/Frame.cs:618) GoogleARCore.Examples.HelloAR.HelloARController:Update() (at Assets/GoogleARCore/Examples/HelloAR/Scripts/HelloARController.cs:93)

This problem only occurs in arcore-unity-sdk-1.10.0 and newer. In earlier versions the code runs fine and prints ”Available” as expected.

Is this a known Issue? Is there a workaround? Any kind of Feedback is very appreciated.

Thank you! Dominik

nickos64252 commented 4 years ago

Hello, I just created a new Unity project, configured it for ArCore. HelloAR works fine, but I have the same error and warning with the ComputerVision example (or any project calling Frame.CameraImage.AcquireCameraImageBytes() )

I have Unity 2018.4 and arcore 1.16.

Thank you