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:

edwar8405

Member
Licensed User
Longtime User
Good day, download the trial apk and it works without problem. But when compiling the test example with the key already created, install it on the cell phone and give some option, it will load the camera and then return to the main screen, if I press a button again it shows this error that appears in the photo . Could you give me more information

Buen día, descarga la apk de prueba y funciona sin problema. Pero al compilar el ejemplo de prueba con la clave ya creada instalarle en el celular y dar en alguna opción hace como que va a cargar la cámara y luego vuelve a la pantalla principal, si vuelvo a presionar un botón muestra este error que aparece en la foto. Me podía dar más información
 

Attachments

  • error .jpg
    error .jpg
    237.7 KB · Views: 448

sasetcolombia

Member
Licensed User
Longtime User
Compiling this example generates this error(Release Mode and without any change).
To Base Example:

** Activity (main) Pause, UserClosed = false **
** Activity (baseexample) Create, isFirst = true **
** Activity (baseexample) Resume **
permission granted...
engine has been initialized: true
helloar_initialize (java line: 215)
java.lang.NoSuchMethodError: No virtual method openWithType(I)Z in class Lcn/easyar/CameraDevice; or its super classes (declaration of 'cn.easyar.CameraDevice' appears in base.apk)
at com.genesis.easyAR.CameraDeviceWrapper.openCamerawithType(CameraDeviceWrapper.java:57)
at com.genesis.easyar.helloar._initialize(helloar.java:215)
at com.genesis.easyar.baseexample._glsurface_surfacecreated(baseexample.java:529)
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.onSurfaceCreated(GLWrapper2.java:1764)
at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1539)
at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1270)
** Activity (baseexample) Pause, UserClosed = true **

-Similar Log to ARVideo and Surface Tracker.

-EASYAR_Example.apk works OK!

Thanks !
 

walterf25

Expert
Licensed User
Longtime User
Good day, download the trial apk and it works without problem. But when compiling the test example with the key already created, install it on the cell phone and give some option, it will load the camera and then return to the main screen, if I press a button again it shows this error that appears in the photo . Could you give me more information

Buen día, descarga la apk de prueba y funciona sin problema. Pero al compilar el ejemplo de prueba con la clave ya creada instalarle en el celular y dar en alguna opción hace como que va a cargar la cámara y luego vuelve a la pantalla principal, si vuelvo a presionar un botón muestra este error que aparece en la foto. Me podía dar más información
Please make sure you are using the OpenGL2 library version 1.5 posted here

Walter
 

walterf25

Expert
Licensed User
Longtime User
Compiling this example generates this error(Release Mode and without any change).
To Base Example:

** Activity (main) Pause, UserClosed = false **
** Activity (baseexample) Create, isFirst = true **
** Activity (baseexample) Resume **
permission granted...
engine has been initialized: true
helloar_initialize (java line: 215)
java.lang.NoSuchMethodError: No virtual method openWithType(I)Z in class Lcn/easyar/CameraDevice; or its super classes (declaration of 'cn.easyar.CameraDevice' appears in base.apk)
at com.genesis.easyAR.CameraDeviceWrapper.openCamerawithType(CameraDeviceWrapper.java:57)
at com.genesis.easyar.helloar._initialize(helloar.java:215)
at com.genesis.easyar.baseexample._glsurface_surfacecreated(baseexample.java:529)
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.onSurfaceCreated(GLWrapper2.java:1764)
at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1539)
at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1270)
** Activity (baseexample) Pause, UserClosed = true **

-Similar Log to ARVideo and Surface Tracker.

-EASYAR_Example.apk works OK!

Thanks !
Make sure you are using OpenGL2 library version 1.5 posted here, and make sure you have the EasyAR.jar file you should have downloaded from the EasyAR website, follow all the steps on the first thread.

Walter
 

darabon

Active Member
Very excellent
Can I use my picture and animation instead of your image?
Or that is a statistic or limit?
 

ronshahrokh

Member
Licensed User
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.

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.
View attachment 84282
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.
View attachment 84283
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.

The Library files can be downloaded from here.
Updated Library version 1.04 can be downloaded from here
Check this post to get the context of the newer version
The APK File can be downloaded from here.

Updated the APK file, now you can see two examples, the Basic Example and a more advanced which renders a Video on top of the tracked images, there are 3 different images the app will render a different video depending on the image tracked, two of the videos are stored in the local storage and a third video is streamed which is why it may take a little longer to start playing. Also uploaded a new video demonstrating how it works.

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.


Library files have also been updated 10/10/2019

Library Documentation can be downloaded from here
Examples Source Code



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.
View attachment 84284 View attachment 84285View attachment 84302

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.
Will this library be updated?
 

walterf25

Expert
Licensed User
Longtime User

hanyelmehy

Active Member
Licensed User
Longtime User
i get this error when try example
B4X:
java.lang.UnsatisfiedLinkError: No implementation found for boolean cn.easyar.Engine.setupActivity(android.app.Activity) (tried Java_cn_easyar_Engine_setupActivity and Java_cn_easyar_Engine_setupActivity__Landroid_app_Activity_2)
    at cn.easyar.Engine.setupActivity(Native Method)
    at cn.easyar.Engine.initialize(Engine.java:9)
    at com.genesis.easyAR.B4AEasyAR.Initialize(B4AEasyAR.java:73)
    at com.easyar.hany.helloarcustom._initialize(helloarcustom.java:231)
    at com.easyar.hany.customcameraactivity._glsurface_surfacecreated(customcameraactivity.java:555)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:732)
    at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:348)
    at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:144)
    at anywheresoftware.b4a.ShellBA$1.run(ShellBA.java:77)
    at android.os.Handler.handleCallback(Handler.java:883)
    at android.os.Handler.dispatchMessage(Handler.java:100)
    at android.os.Looper.loop(Looper.java:214)
    at android.app.ActivityThread.main(ActivityThread.java:7410)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:935)
** Service (starter) Destroy (ignored)**
** Activity (customcameraactivity) Pause, UserClosed = true **
 

ronshahrokh

Member
Licensed User
EasyAR Sense 4.0 Personal
Free, not for commercial use, with watermark, the number of SpatialMap download API request is limited to 100 times per day.
EasyAR Sense 4.0 Professional
Monthly payment, no watermark,customized number of SpatialMap download API request.
EasyAR Sense 4.0 Classic
One-time charge for lifetime use, no watermark,all features of Professional included.


EasyAR Sense basic no exist
 

Goles

Member
Licensed User
Hi Walter,
I have a question about your perfect AR library.
Does it work with new versions of EasyAR Sense License Keys? I bought Sense 4.0 Professional License Key and do every step you mentioned in your EasyAR thread, But it does not work...
When I use EasyAR.jar file Version 3.0.1 my camera does not load and I see a blank gray view, and when I use EasyAR.jar file Version 4.5.0 my app crashes...
Do you know what is the problem? If you have any solution for me please share, because I'm in a complicated situation...
Thanks for your Helping.
 

walterf25

Expert
Licensed User
Longtime User
Hi Walter,
I have a question about your perfect AR library.
Does it work with new versions of EasyAR Sense License Keys? I bought Sense 4.0 Professional License Key and do every step you mentioned in your EasyAR thread, But it does not work...
When I use EasyAR.jar file Version 3.0.1 my camera does not load and I see a blank gray view, and when I use EasyAR.jar file Version 4.5.0 my app crashes...
Do you know what is the problem? If you have any solution for me please share, because I'm in a complicated situation...
Thanks for your Helping.
I am working on updating the library, there are lots of changes since I wrapped this Library, I will try to make the changes as time allows me.

Regards,
Walter
 

Cesar Guerra Torres

New Member
Licensed User
Longtime User
In the sample, exist the next error:

Compilando el código Java generado. Error
B4A line: 128
For Each img As ObjectTracker In trackers
src\com\genesis\easyar\helloar3.java:116: error: package cn.easyar does not exist
_img = (com.genesis.easyAR.ObjectTrackerWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new com.genesis.easyAR.ObjectTrackerWrapper(), (cn.easyar.ObjectTracker)(group1.Get(index1)));
 

walterf25

Expert
Licensed User
Longtime User
In the sample, exist the next error:

Compilando el código Java generado. Error
B4A line: 128
For Each img As ObjectTracker In trackers
src\com\genesis\easyar\helloar3.java:116: error: package cn.easyar does not exist
_img = (com.genesis.easyAR.ObjectTrackerWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new com.genesis.easyAR.ObjectTrackerWrapper(), (cn.easyar.ObjectTracker)(group1.Get(index1)));
Did you follow the instructions in the first post, you need to download the EasyAR SDK kit and extract the EasyAR.jar file and copy it to your additional folder.
 

syerif

Active Member
Licensed User
Longtime User
Hi,

Any help please, I can not use APK or source code, the APK shows a black screen, after i debug the source code it is loop at Sub glsurface_Draw(gl As GL2) because not initalized.

any step may be I miss?

Best regards
 

walterf25

Expert
Licensed User
Longtime User
Hi,

Any help please, I can not use APK or source code, the APK shows a black screen, after i debug the source code it is loop at Sub glsurface_Draw(gl As GL2) because not initalized.

any step may be I miss?

Best regards
Do you get any errors in the logs?
 

walterf25

Expert
Licensed User
Longtime User
Hi , any updates for library ?
for EasyAR Sense 4.x
Hi, the library is using the 4.x SDK, however I have not wrapped the Sparse SpatialMap or Dense SpatialMap classes.
 
I followed all instructions, and change all keys with package name but I have this problem

Logs:
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (baseexample) Create (first time) **
** Activity (baseexample) Resume **
permission granted...
Fatal signal 6 (SIGABRT), code -1 (SI_QUEUE) in tid 14856 (GLThread 117069), pid 14317 (com.tecknow.ar)
*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
Build fingerprint: 'samsung/b0qxxx/b0q:14/UP1A.231005.007/S908EXXUAEXH7:user/release-keys'
Revision: '12'
ABI: 'arm64'
Processor: '-1'
Timestamp: 2024-10-23 11:12:39.676160988+0400
Process uptime: 7s
Cmdline: com.tecknow.ar
pid: 14317, tid: 14856, name: GLThread 117069  >>> com.tecknow.ar <<<
uid: 10994
tagged_addr_ctrl: 0000000000000001 (PR_TAGGED_ADDR_ENABLE)
pac_enabled_keys: 000000000000000f (PR_PAC_APIAKEY, PR_PAC_APIBKEY, PR_PAC_APDAKEY, PR_PAC_APDBKEY)
signal 6 (SIGABRT), code -1 (SI_QUEUE), fault addr --------
Abort message: 'terminating with uncaught exception of type std::out_of_range: unordered_map::at: key not found'
    x0  0000000000000000  x1  0000000000003a08  x2  0000000000000006  x3  0000006fc2bf7160
    x4  736f646277641f73  x5  736f646277641f73  x6  736f646277641f73  x7  7f7f7f7f7f7f7f7f
    x8  00000000000000f0  x9  0000007356e5b278  x10 0000000000000001  x11 0000007356ea3b60
    x12 000000737738e020  x13 000000007fffffff  x14 000000001e8d023a  x15 00001c24007a14a7
    x16 0000007356f0cd18  x17 0000007356ee7680  x18 0000006f37ed6000  x19 00000000000037ed
    x20 0000000000003a08  x21 00000000ffffffff  x22 ffffff80ffffffc8  x23 0000006fc2bf73b0
 
Top