After playing around with AR, I’ve decided to make a B4A library from an existing AR library: NyARToolkit (http://nyatla.jp/nyartoolkit/).
Some functions did not work properly and I had to rewrite some of them so they could fit in a B4A library. I also wanted to use the GLSurfaceView from Andrew Graham in basic4android. To do this, I had to extract everything that had to do with 3D and OpenGL. It took some fiddling around, but I think I cracked it.
With a couple of lines in b4a, I can now find the markers and put a 3D model on top of it. The speed and accuracy of the NyARToolkit is ok and it is certainly possible to make some fun projects.
Just to play around, I’ve put one of my favorite superheroes on top of the marker. Batman to the rescue!
Example of the code needed to get the markers:
Sub ABAR_MarkersFound() Dim Vect As ABARVector2D Dim a As Int Dim b As Int Dim Markers As List Markers.Initialize Markers = ABAR.GetMarkers() Dim corners As List corners.Initialize Dim Msg As String FoundMarkers = markers.Size - 1 For a = 0 To foundMarkers Mark = Markers.Get(a) conf(a) = Mark.Confidence counter = 0 Msg = "Marker: " & Mark.ARCodeIndex & CRLF Msg = Msg & "x:" & Mark.Center.x & " y:" & Mark.Center.y & CRLF Msg = Msg & "Confedence:" & Mark.Confidence & CRLF Corners = Mark.Corners Vect = Corners.Get(0) Msg = Msg & "Corner1=x:" & vect.x & "y:" & vect.y & CRLF Vect = Corners.Get(1) Msg = Msg & "Corner2=x:" & vect.x & "y:" & vect.y & CRLF Vect = Corners.Get(2) Msg = Msg & "Corner3=x:" & vect.x & "y:" & vect.y & CRLF Vect = Corners.Get(3) Msg = Msg & "Corner4=x:" & vect.x & "y:" & vect.y & CRLF Markfound = True For b = 0 To 15 tmpresultf(a,b) = Mark.resultf(b) tmpcameraRHf(b) = Mark.cameraRHf(b) Next Msg = Msg & CRLF useRHfp = True drawp = True Log(Msg) Next glsv.RequestRender End Sub
Hi, is your Augmented Reality libary available on the basic4android development tool, i looked in the libraries but could find. Is there a download somewhere.
thanks in advance, Mark
Hi Mark,
The library is not public yet. It is more or less experimental and should be reworked. I recall speed was an issue because it was a Windows AR library that was rewritten for Android.
Cheers,
Alwaysbusy
Hi, did you have any update about your progress with the AR library. I’m very interested in test it and play with it.
Thanks Eddy
Hi Eddy,
No, no further updates on this. Lost the existing code with a HD crash and never found the time to restart on it. Maybe something can be created with OpenCV now it is also available on Android.
Cheers,
Alain