B4A Library EasyAR (Augmented Reality) Library

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.
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.

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 1.35 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 09/13/2022
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.5.

Library files have also been updated 9/13/2022




Updated Source Code 09/13/2022
Example Source Code 1.1




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
B4A Version: 9.50
Java Version: 11
Parsing code. (0.10s)
Building folders structure. (0.02s)
Compiling code. (0.96s)
Compiling layouts code. (0.00s)
Organizing libraries. (0.00s)
(AndroidX SDK)
Generating R file. (0.00s)
Compiling debugger engine code. (5.22s)
Compiling generated Java code. Error
src\com\genesis\easyar\arvideo.java:34: error: cannot find symbol
public com.genesis.easyAR.ARVideoWrapper _videoplayer = null;
^
symbol: class ARVideoWrapper
location: package com.genesis.easyAR
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: src\com\genesis\easyar\cameraexclass.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
1 error
javac 11.0.1
 

Attachments

  • TempDownload.png
    TempDownload.png
    11.5 KB · Views: 318

walterf25

Expert
Licensed User
Longtime User
B4A Version: 9.50
Java Version: 11
Parsing code. (0.10s)
Building folders structure. (0.02s)
Compiling code. (0.96s)
Compiling layouts code. (0.00s)
Organizing libraries. (0.00s)
(AndroidX SDK)
Generating R file. (0.00s)
Compiling debugger engine code. (5.22s)
Compiling generated Java code. Error
src\com\genesis\easyar\arvideo.java:34: error: cannot find symbol
public com.genesis.easyAR.ARVideoWrapper _videoplayer = null;
^
symbol: class ARVideoWrapper
location: package com.genesis.easyAR
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: src\com\genesis\easyar\cameraexclass.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
1 error
javac 11.0.1
src\com\genesis\easyar\arvideo.java:34: error: cannot find symbol
This tells me you have not added the EasyAR.jar file to your additional library files.

Read the first post

Walter
 

walterf25

Expert
Licensed User
Longtime User

walterf25

Expert
Licensed User
Longtime User
Can you post the full Logs?

Walter
I have updated the library files, for some reason the xml file wasn't uploaded correctly, I believe it was an older version, please download the library files again, i've updated the link to it in the first post, they should work fine now. Sorry about that.
Library Files Updated
 

walterf25

Expert
Licensed User
Longtime User
Ok this solved my problem. Thank you!
A question. As we can modify the 3D figures, is it also possible to use other types of images?
Yes, 3D object models can be used as well.

As I mentioned on my first post, this is going to be an on going effort, there's still lots to learn and to do with this library.

Walter
 

walterf25

Expert
Licensed User
Longtime User
Like the files you used to make the 3D Box "box_frag.frag"
No, those are called fragment shader and vertex shader files, I mean like real 3D Object models, like you could use a software like Blender and create your own 3D models and render them with this library.

I suggests you dig a little deeper on the EasyAR website, they have some information regarding this.

Walter
 

peacemaker

Expert
Licensed User
Longtime User
EasyAR.jar file to your additional library files
Trouble was that Jetifying of the lib is required step.
The latest code example is compiled OK (after Jetifying) and works OK in Release mode.
No one button mode works in Debug mode, just black screen and errors in the logcat.
 
Last edited:

walterf25

Expert
Licensed User
Longtime User
Trouble was that Jetifying of the lib is required step.
The latest code example is compiled OK (after Jetifying) and works OK in Release mode.
No one button mode works in Debug mode, just black screen and errors in the logcat.
Yes, it will not work in Debug mode, need to run in release mode.
 

walterf25

Expert
Licensed User
Longtime User
Do you have to buy the full EasyAR license? Or does this work with their basic (free) license?
It will work with their basic (free) license.

Walter
 

walterf25

Expert
Licensed User
Longtime User
If it works with the free license, I suppose it does not track 3D objects then? I see that it tracks 2D with the free license.
It does work with 3D objects but there's a limit of how many per day.

Walter
 

coslad

Well-Known Member
Licensed User
Longtime User
Hi

what is the best way to generate etd files ?
I saw they provide some sample windows app , what do you suggest ?
How big have to be the image ?

Thanks
 

walterf25

Expert
Licensed User
Longtime User
Hi

what is the best way to generate etd files ?
I saw they provide some sample windows app , what do you suggest ?
How big have to be the image ?

Thanks
There is an example in the SDK for windows, where you need to point to the file you want to convert, I will try to compile it and see if i can upload it sometime.

Walter
 

walterf25

Expert
Licensed User
Longtime User
Hi

what is the best way to generate etd files ?
I saw they provide some sample windows app , what do you suggest ?
How big have to be the image ?

Thanks
I threw a quick Example together to generate the .etd files from the jpg files, go through the example to see how to accomplish this.
This example will not show the camera or render anything on the screen, it just simply generates the .etd files, i added two more functions to the library, one function to the ImageTracker class which saves the file as an .etd file, and a second one to the B4AEasyAR class which creates a target from the generated .etd files.

https://drive.google.com/open?id=1JARiMMzFOs02MwPk4vsOzrf41PosOcDn

The relevant code to convert the jpg images to .etd files is the following code:
B4X:
Public Sub SaveTargetToETDFile
Dim targets As List
targets = tracker.ImageTargets
Log("targets size: " & targets.Size)
For i = 0 To targets.Size - 1
    Dim imgtarget As ImageTarget
    imgtarget.Initialize(targets.Get(i))
    Log("saving ETD files: " & imgtarget.SaveAsETD(rp.GetSafeDirDefaultExternal("images")))
Next
End Sub

I have updated the Library files to 1.04 and it's been loaded to the first post of this thread.

Hope this helps.

Walter
 
Top