B4A Library EasyAR (Augmented Reality) Library UPDATED!

Hello everyone, I would like to introduce this Beta version of my B4AEasyAR Library, i have been trying to wrap an AR Library for some months now but have came across some issues while wrapping some of the functions.
I read a post by someone about EasyAR, spent some time looking at the documentation and examples and decided to give it a try, i finally have something that works good and wanted to share it with everyone, please keep in mind that I am not a Java expert, however i am taking an advanced Java class in college along with Python and iOS.

Please note that the updated library requires google_ar SDK, I have linked a copy of the .aar here file but you can also download it from their website. Also check out the manifest file as there's an extra entry tag that needs to be added, the reason is that the new SDK will check if Google AR is installed on your device, it also checks the version and if it needs to be updated.
Manifest:
AddApplicationText(<meta-data android:name="com.google.ar.core" android:value="required"/>
        <meta-data android:name="com.google.ar.core.min_apk_version" android:value="181012000"/>)

AddApplicationText(<activity
            android:name="com.google.ar.core.InstallActivity"
            android:configChanges="keyboardHidden|orientation|screenSize"
            android:excludeFromRecents="true"
            android:exported="false"
            android:launchMode="singleTop"
            android:theme="@android:style/Theme.Material.Light.Dialog.Alert" />
            <meta-data
            android:name="com.google.ar.core.min_apk_version"
            android:value="181012000" />)

Ok, in order to be able to use this library you will need to register for an account at EasyAR website once you have signed up, you can login and you will need to create an SDK License key.
create_license.PNG
Just click on the Add SDK License Key button, you will be prompted to choose what type of license key you need to generate, Select EasyAR SDK Basic option, next you will need to enter your App's name, then go ahead and Select Android for Supported Platform and lastly you need to enter the same package name you used when creating your application.
app_info.PNG
Once the SDK key is generated you will be able to see it by clicking on the Name of the application created, copy and save your key as you will need it.

I have attached a very simple example which is the very same example that comes with their SDK, what the app does is that it tracks two different images and renders a 3D cube on top of the image, as i mentioned this is a very simple example but just imagine the possibilities.

I have also attached a small video i made showing the app in action, the bxRenderer class is where all the magic happens and it an be modified to your taste granted that you are familiar with OpenGL.

I am using @agraham OpenGL2.0 library, i was almost half way wrapping the OpenGL2.0 library when i realized that it had already been done for us in the forums by @agraham so a big thanks to him for his hard work, it truly saved me lots of time, i added a few functions to his library that were needed with EasyAR library, i have sent him the updated OpenGL2.0 version 1.5 library for him to upload it to his original thread.

B4AEasyAR library uses your device's camera to track certain images that you can upload either to your device or the cloud, currently i have not wrapped any of the functions to be able to recognize images uploaded to the cloud.

I suggest you guys do some research on your own about the capabilities of this SDK, this will be an ongoing effort to maintain this library updated, I think it was definitely time that a library like this was needed in our forums.

For now I will only upload the jar and xml file, you will need to download the SDK once you are signed up with EasyAR.com and copy the EasyAR.jar file that comes with the SDK and paste it into your additional library folder.

Please test the attached APK file, and let me know what device and android version you guys test on, and of course post any problems or suggestions you come across.

Library and examples have been updated with latest EasyAR SDK 4.x Sense

Please make sure to download the latest EasyAR SDK files, find the EasyAr.jar file copy it and paste it into your additional libraries folder.



Updated library files, jar and xml files version 2.15 can be downloaded from here




APK has been updated with a few more examples and can be downloaded from here.



The updated apk file contains a few more examples and has been updated with the latest EasyAR SDK library, note that a watermark is displayed on the screen if using a free license, in order to get rid of the watermark you must purchase a license.

UPDATE
I am releasing the Source code of the Examples I have already shown, plus two more examples, one using a custom camera class which uses the Android Camera class and Surface Tracker example.
I am also attaching the documentation for the library, the library is also being updated as I have added a few more things to it.


UPDATE 10/27/2024
Source code for the new examples apk has also been updated, this updates contain two more examples, multi-tracker example and Object Tracker example. These Updates have been done with the latest EasyAR SDK library 4.6.x

Library files have also been updated 10/27/2024



Updated Source Code 10/27/2024
Example Source Code 1.2.5




You will need to either print out a copy of the two images being used in this example to test the app or just open them up on your laptop and point the camera to the image on your screen, either way will work fine.
idback.jpg namecard.jpgargame00.jpg

and lastly here's the video I made to show the app in action.

Please Donate if you guys find this library useful, i have spent a lot of hours and I will keep this library updated as necessary, your donations will keep me motivated to continue maintaining this library.

Thanks all, can't wait to see what type of apps can be created with this new Library.
 
Last edited:

peacemaker

Expert
Licensed User
Longtime User
Wow !
Example APK works OK (over both base images) on Samsung A7 (2017) Android 8.0.

Very interesting to try the lib (and donate a bit later), but, it seems, no ready code example yet.
 

walterf25

Expert
Licensed User
Longtime User
Wow !
Example APK works OK (over both base images) on Samsung A7 (2017) Android 8.0.

Very interesting to try the lib (and donate a bit later), but, it seems, no ready code example yet.
Glad to know the example apk works good for you, code example is ready but want to prepare a few more examples before releasing the actual B4A code.

Walter
 

walterf25

Expert
Licensed User
Longtime User
Updated the first post, updated the apk to demonstrate the basic example and a more advanced by rendering videos on top of the tracked images, Please test and let me know if you guys have any issues.

Walter
 

peacemaker

Expert
Licensed User
Longtime User
updated the apk to demonstrate the basic example and a more advanced
Yes! New APK works as on your video. The first video-audio presentation is also being loaded rather long time before start.
 

bluedude

Well-Known Member
Licensed User
Longtime User
All cool but I need a sample to track an image and load the video. Cannot do anything with the .apk. Do you have the source for this .apk?
 

walterf25

Expert
Licensed User
Longtime User
All cool but I need a sample to track an image and load the video. Cannot do anything with the .apk. Do you have the source for this .apk?
I do have the source code, but i am not releasing it yet, this is a very big and complicated library and i am still wrapping a lot of the classes. this apk i have posted works with only of a few of the classes wrapped.

Walter
 

DaniDPX

Member
Licensed User
@walterf25 Awesome work you’ve done! I’ve been looking for an AR/VR library for a while and finally I got 1 working lib. Can’t wait to integrate it with my app.

[update] when are you planning to release examples?
 
Last edited:

walterf25

Expert
Licensed User
Longtime User
Updated the Library files, I have also posted a link to the Examples source code and the libraries documentation as well.

Walter
 

walterf25

Expert
Licensed User
Longtime User

Johan Hormaza

Well-Known Member
Licensed User
Longtime User
** Activity (main) Pause, UserClosed = false **
** Activity (surfacetrackingactivity) Create, isFirst = true **
** Activity (surfacetrackingactivity) Resume **
permission granted...
engine has been initialized: true
surfacetrackerar_vvv5 (java line: 210)
java.lang.InstantiationException: java.lang.Class<cn.easyar.OutputFrame> has no zero argument constructor
at java.lang.Class.newInstance(Native Method)
at com.genesis.easyAR.OutputFrameWrapper.Initialize(OutputFrameWrapper.java:24)
at com.genesis.easyar.surfacetrackerar._vvv5(surfacetrackerar.java:210)
at com.genesis.easyar.surfacetrackingactivity._glsurface_draw(surfacetrackingactivity.java:496)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:196)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:180)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:176)
at anywheresoftware.b4a.agraham.opengl2.GLWrapper2$GLSurfaceViewWrapper2$myRenderer.onDrawFrame(GLWrapper2.java:1734)
at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1553)
at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1253)
 

walterf25

Expert
Licensed User
Longtime User
** Activity (main) Pause, UserClosed = false **
** Activity (surfacetrackingactivity) Create, isFirst = true **
** Activity (surfacetrackingactivity) Resume **
permission granted...
engine has been initialized: true
surfacetrackerar_vvv5 (java line: 210)
java.lang.InstantiationException: java.lang.Class<cn.easyar.OutputFrame> has no zero argument constructor
at java.lang.Class.newInstance(Native Method)
at com.genesis.easyAR.OutputFrameWrapper.Initialize(OutputFrameWrapper.java:24)
at com.genesis.easyar.surfacetrackerar._vvv5(surfacetrackerar.java:210)
at com.genesis.easyar.surfacetrackingactivity._glsurface_draw(surfacetrackingactivity.java:496)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:196)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:180)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:176)
at anywheresoftware.b4a.agraham.opengl2.GLWrapper2$GLSurfaceViewWrapper2$myRenderer.onDrawFrame(GLWrapper2.java:1734)
at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1553)
at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1253)
Are you running in Release Mode or Debug mode?
 

walterf25

Expert
Licensed User
Longtime User
Are you using the latest Lib 1.01, and have you downloaded the EasyAR Jar file from their website and added it to the Additional Libraries folder?

Walter
 

peacemaker

Expert
Licensed User
Longtime User
Walter, please, publish all B4A depending libs versions, to be sure.
 

walterf25

Expert
Licensed User
Longtime User
Yes, I downloaded the 1.01 library, but I downloaded it from EasyAR.jar from this place https://www.b4x.com/android/forum/threads/can-i-convert-easyar-jar-to-b4a-and- b4i-lib.109326 /
Does the APK example i posted work for you?

I just tested here again and i don't see that problem, i would suggest you register at https://www.easyar.com/ follow the instructions in the first post to create an App and receive your own License key.

Can you post the full Logs please?
Walter
 
Top