EasyAR 4.0 Error on Android

+2 votes
asked Jan 6 by ggtech (160 points)
Hello, on january 3rd this year, I bought one month of EasyAR 4.0, with which I generated a “SHK License Key” and a “Package name” for Android.

The problem I’m currently having is that “ImageTracking_TargetOnTheFly” works perfectly on a PC, but it won’t recognize the photo I’ve taken on Android. In other words, for both cases (PC and Android), the app runs perfectly and it works when I click on “Take Photo”. Nonetheless, the augmented reality only activates on the PC, not on Android.

The steps I followed are:

1.- I downloaded “EasyARSenseUnityPlugin_4.0.0-final_UnityPlugin.zip” and “EasyARSenseUnityPlugin_4.0.0-final_UnityPlugin_Samples.zip”.

2.- In Unity, I created a new project and imported the package “EasyARSense_4.0.0-final_UnityPlugin_Samples.unitypackage”

3.- I set up Unity in “Player Settings…”, so that the “Package name” in Unity matches the “Package name” I registered in EasyAR,

4.- I opened the Scene named “ImageTracking_Targets”. In Build Settings, within the group “Scenes in Build”, the only marked scene is “Samples/Scenes/ObjectSensing/ImageTracking_Targets”

5.- In “Platform”, I selected “PC, Mac & Linux Standalone”, I set it up so that my window wasn’t maximized and I clicked on “Build”. I executed my app’s EXE file, pointed at the image named “namecard.jpg” with my webcam and the augmented reality worked perfectly.

6.- For Android, in Platform, I selected “Android” and I confirmed that the “Package name” in Unity matched the “Package name” that I registered in EasyAR. Then, I clicked on “Switch Platform” and subsequently on “Build”. I installed the app on my phone, pointed to the photo named “namecard.jpg” with my camera and the augmented reality worked correctly.

After that, I proceeded to make some tests with the example “ImageTracking_TargetOnTheFly”, repeating the same steps I mentioned in the previous paragraphs. On my computer, I clicked on “Take Photo”, which displayed a “Photo Saved” message and the augmented reality started working, but in an unstable way (the 3D object was shaking, but it worked)

I generated that same app, but for Android. The augmented reality didn’t work and didn’t display any object at all. I tried to make it work in different ways. For example: using the complete “namecard.jpg” image, then just a cropped part of it and it didn’t work on Android.

What am I doing wrong? What should I do in order to make it work properly?

Thank you very much, have a great day.

2 Answers

0 votes
answered Jan 7 by bagasbimo19 (170 points)
i have same problem with easy ar 4.0
0 votes
answered 5 days ago by kenn (5,990 points)
We finally reproduced the situation. The reproduced environment is on Pixel 3, Android Q, Unity 5.6, and the most important, 2x/4x AA.

So the most straight forward fix is to disable AA in the sample, then it should work. While in your own projects, it is suggested to understand the API (EasyAR folder) calling and make your own solution.

We consider to make an elegant fix of this sample in later releases.

=======

More about the issue:

This issue is somewhat related to a very old Unity issue (https://forum.unity.com/threads/readpixels-creates-black-image-answered.59060/#post-1133448).

The main problem of the issue is how reliable Texture2D.ReadPixels is. We use readpixels in this sample to create an image from screen. According to the above link (although it's too old to reference) and what we observed, when AA is turned on on some devices, readpixels do not work.
commented 5 days ago by zhangpengar (2,900 points)
I think this is the OpenGL(ES) limitation with glReadPixels and MSAA.
Welcome to EasyAR SDK Q&A, where you can ask questions and receive answers from other members of the community.
...