My favorites | Sign in
Project Home Downloads Wiki Issues Source
Search
for
HowToBuildApplicationsBasedOnAndAR  
This page describes how someone can build augmented reality applications using AndAR.
Updated Jun 28, 2010 by tdomhan

License

The whole project is released under the GNU General Public License. This means it can be used in any project that is itself released under the GPL. If you would like to create a commercial application based on AndAR please contact ARToolworks.

Eclipse sample project Howto

This section is about the Eclipse sample project, alternatively you may check out the source code from the SVN repository.

AndAR Architecture

AndAR is an Augmented Reality Framework for Android. It not only offers a pure Java API but is also object oriented. The figure above shows a simplied class diagram of an application that makes use of AndAR.

Every Android application consists of one or more Activities. An Activity is a visual user interface, targeted to a single purpose. Only one may be active at a time. In order to write an Augmented Reality application, one has to extend the abstract class AndARActivity. This class already handles everything Augmented Reality related, like opening the camera, detecting the markers and displaying the video stream. The application would run already, by just doing that. However it would not detect any markers.

In order to do so, you have to register ARObjects to an instance of ARToolkit. This instance can be retrieved from the AndARActivity. The ARObject class itself is abstract. This means, it has to be extended, too. It expects the file name of a pattern file in it's constructor. This file must be located in the assets folder of the Eclipse project.

Pattern files can be created by a tool called mk_patt, as described here. They are used to distinguish different markers. In order to draw a custom object, the method draw has to be overridden. Before this method is invoked a transformation matrix will already have been applied. This means the object will be alligned to the marker, without any further steps. This method will not be invoked, if the marker belonging to this object is not visible.

The class ARRenderer is reponsible for everything OpenGL related. If you want to mix augmented with non augmented 3D objects you may provide a class implementing the OpenGLRenderer interface. There are three methods defined by this interface. initGL being called only once, when the OpenGL surface is initialized. Whereas setupEnv is called once before the augmented objects are drawn. It can be used to issue OpenGL commands that shall effect all ARObjects, like initializing the lighting. In the draw method you may draw any non augmented 3D objects. It will be called once for every frame. Specifying such the described renderer is optional. The AndARActivity furthermore offers a method that allows the application to take screenshots.

Comment by bigban...@gmail.com, Apr 29, 2010

I'm really impatient to try this =)

Comment by project member tdomhan, Apr 29, 2010

I'm really busy writing my exams right now. so you have to wait like a week or so, sorry :/

Comment by bigban...@gmail.com, May 1, 2010

no problem ^^ Good luck for your exams

Comment by xueling...@gmail.com, May 8, 2010

hey tdomhan, hope everythings going well with you exams, really looking forward to the sample app, hope it will come out soon. btw I am a new comer for android, and thanks for all your work

Comment by bowbowya...@gmail.com, May 17, 2010

Hey, tdomhan, ur project looks very awesome. good luck for ur exam and I also look forward to see ur sample Eclipse project.

Comment by hoek...@gmail.com, May 18, 2010

Please notify when eclipse project sample is updated, thanx

Comment by juanigna...@gmail.com, May 21, 2010

Also waiting for it :)

Comment by project member tdomhan, May 24, 2010

alright here you go, feel free to ask any questions ;)

Comment by juanigna...@gmail.com, May 24, 2010

First question =D

Just imported, but it won't run. Compile errors: [2010-05-24 16:48:40 - AndARSampleProject] The library 'AndAR.jar' contains native libraries that will not run on the device. [2010-05-24 16:48:40 - AndARSampleProject] Additionally some of those libraries will interfer with the installation of the application because of their location in lib/ [2010-05-24 16:48:40 - AndARSampleProject] lib/ is reserved for NDK libraries. [2010-05-24 16:48:40 - AndARSampleProject] The following libraries were found: [2010-05-24 16:48:40 - AndARSampleProject] - lib/armeabi-v7a/libar.so [2010-05-24 16:48:40 - AndARSampleProject] - lib/armeabi-v7a/libyuv420sp2rgb.so [2010-05-24 16:48:40 - AndARSampleProject] - lib/armeabi/libar.so [2010-05-24 16:48:40 - AndARSampleProject] - lib/armeabi/libyuv420sp2rgb.so

Any way to solve this?

Comment by project member tdomhan, May 27, 2010

mh maybe the new version of the SDK is producing those errors. My version is a bit outdated. I'm going to update now.

Comment by project member tdomhan, May 28, 2010

alright, I uploaded a new version that works with the new SDK. I hope everything works, if not just say so :D enjoy!

Comment by hoek...@gmail.com, May 31, 2010

problem [2010-05-31 09:09:54 - AndARSampleProject] Android requires .class compatibility set to 5.0. Please fix project properties.

sorry im noob

Comment by project member tdomhan, May 31, 2010

a update to the newest SDK should solve your issue

Comment by bummipo...@hotmail.com, Oct 31, 2010

Hi and thanks for a nice framework! :)

I've made my own mark and it works great, but I have one question: How can I replace the cube with another 3D-model? A friend made a 3D-model (.obj) which I would like to match with my mark. Would be great if you could help me out.

Thanks again! //Louise

Comment by project member tdomhan, Nov 8, 2010

with AndAR itself you do not have the possiblity to display obj models directly. you would have to parse the file yourself and then issue the appriate OpenGL commands in the the draw function of the ARObject. However this is where the AndAR Model Viewer comes into play. It is able to load/display obj models on AR Markers. It is also available from the SVN repository. If you have any questions don't hestitate to ask.

Comment by sterne...@gmail.com, Nov 9, 2010

@tdomhan: We have figured out that much, is it posible that you could tell us which parts of the code provided on the SVN that you have to use and i what order you should ude it in order to make it work? Or better yet, make the AndAR Model Viewer available in the same way that AndAR is, as a sample project?

Comment by rupam.bh...@gmail.com, Nov 17, 2010

The explanation of the AndAR is very helpful. But, I need to use your AndAR Model Viewer to load different Obj models for different markers. Could you also write a similar explaination of the "AndAR Model Viewer" architecture and how to use it for a purpose like mine.

Looking forward to using your toolkit for my application. Once it is concrete, I shall share the details and probably get my app listed in your esteemed list of user apps! :)

Comment by bummipo...@hotmail.com, Nov 19, 2010

@tdomhan: Thanks for your reply! I downloaded all the files for the AndAR Model Viewer but I can't seem to make them work together as a project; e.g. Eclipse won't generate a R.java-file. I'm not used to Eclipse so it's making me a bit frustrated. Can you by any chance upload the Model Viewer as a .zip/.rar (just like the AndAR)? It would be extremely helpful.

Thank you for your help! //Louise

Comment by sterne...@gmail.com, Nov 28, 2010

We figured out how to get the files: You have to use a SVN-client like "Tortoise SVN" and commit a folder on your computer to the project SVN for AndAR.

Then you can access the files and create a project like the sample project in eclipse.

Thank you so much tdomhan for all your work and we will report back to you on our progress!

Comment by sterne...@gmail.com, Nov 29, 2010

This is the URL that you should commit to: http://andar.googlecode.com/svn/trunk/

Maybe you have to have a google account (gmail account) in order to access the SVN?

I did not get the prompt for password/username but i am allways logged in on my google account.

Comment by valeo...@gmail.com, Feb 23, 2011

Hello and congratulations for your great project.

I'm trying to compile it on the Galaxy Tab and I get 13 errors "The method of type must override a superclass method". I'm using Android 2.2

Do you have any ideas or suggestions I could try out?

Thank you,

f.

Comment by carlosre...@gmail.com, Mar 16, 2011

AndARSampleProject but I do not want to see more than the green figure, I would like to place my own modeling. I can help. i know that everything is based in customactivity but wondered how to make that smaller class without calling the other two classes and just create a class where I called my 3d object assets folder. thank you very much.

Comment by norma...@gmail.com, Mar 23, 2011

Hi!

I would like to know how can I implement textures in cubes. I'm trying to do it but it didn't work yet.

Thanks in advance.

Comment by rahul.de...@gmail.com, Apr 10, 2011

Hi, I have downloaded your application. But it is giving error in Eclipse. It is giving error in package declaration also and saying to configure build path even though the jar file is there.

Comment by rahul.de...@gmail.com, Apr 10, 2011

Sorryyy it is solved now....

Comment by dala...@gmail.com, Apr 19, 2011

Hi all, I am trying to modify sample app to use my own 3D model, but no success!! Anybody can publish a tutorial (or any help) about rewriting AndAR to show a specific 3D model instead of the cube? I have also reviewed AndAR Model Viewer, but it is far more complex from what I am looking for (only custom 3D model rendering with custom marker). An open source solution dealing with this feature will help us to maximize AR impact, lowering the enry barrier to many use cases!!

Comment by sabasidd...@gmail.com, Apr 26, 2011

Hi , i am able to use my own 3d model but a problem occurs- camera is not showing the background image of the view only the the 3d image appears and as i move the marker the object too moves. i want the black background to change in yhe view captured by the camera. Can anybody help me....

Comment by bertram....@gmail.com, May 6, 2011

Hi,

is it possible to create something like this with AndAR?

Alex

Comment by derekla...@gmail.com, May 25, 2011

hi all. anyone could give a tutorial for replacing the 3D cube to my 3d model?

Comment by masp...@gmail.com, Jun 15, 2011

could anyone tell me how to replace the green box to my own model??/ thx

Comment by meryq...@gmail.com, Jul 3, 2011

Hi, How could I use a socket camera to run the AndAR in emulator on PC?

Comment by junt...@gmail.com, Jul 17, 2011

Hi, I am an android developer. Is there any step by step tutorials for learning andar basics. If yes can anybody ping me at junto06@gmail.com with subject of "ANDAR BASICS". Thank you !

Comment by gae.gu...@gmail.com, Aug 29, 2011

Hello, I am developing an Android project based on Bluetooth communication between a sensor and my phone, and on Augmented Reality: the sensor sends a message to my phone, and this message has to be displayed on the screen when the marker (placed near the sensor) is detected. So, my question is: how can I replace the green cube of AndARSampleProject, with a simple text? Please help! Thank you!

Comment by eric.va...@gmail.com, Sep 11, 2011

I wrote '2d barcode marker generator' for creating specific 3x3 or 4x4 values from your android. I did it out of my own need and have used it in testing many applications.

Comment by vahakark...@gmail.com, Oct 20, 2011

Hello! Is there any device specification requirements like processor speed, etc for this application? Thank you in advance.

Comment by asant...@trinity.edu, Nov 8, 2011

What kind of strategies would you use to pick an object by touching the screen? I see that you did that with andARPong and the ModelViewer? but I'm wondering what kinds of things you did. Basically, if there are multiple models on the screen and you want to pick one object to manipulate, how would I go about doing so? I understand the basic concept because of a tutorial I found here http://magicscrollsofcode.blogspot.com/2010/10/3d-picking-in-android.html but I do not know how to translate that into this project. If anyone could help I would really appreciate it

Comment by gagangak...@gmail.com, Dec 19, 2011

Hello I am intrigued by AndAR's capapbilities. I am working on something slightly different. I need to detect a person's face and add 3d objects to the camera preview as special effects in real-time. I understand that AndAR places objects on markers so I would really appreciate if someone could tell me a workaround to place objects at a particular position given by FaceDetector?.Face. It provides the necessary coordinates and rotation angles after detecting the face.

Comment by raomohsi...@gmail.com, Dec 29, 2011

hello all i am new on google app engine i need your help please give me idea for creating application on cloud i have to submit project in university

Comment by u0803...@gmail.com, Jan 1, 2012

Can anyone guide me on how to draw or overlay the texture using AndAR? I cant figure it out!

Comment by surezhbt...@gmail.com, Jan 4, 2012

hi tdomhan,

How can I replace the 3D cube with the simple text...Please help out

Comment by AgentD...@gmail.com, Feb 11, 2012

When is there going to be a tutorial how to develop this? All I want to do is add video, yet there is no mention about that anywhere...

Comment by hdumi...@gmail.com, Feb 12, 2012

Hello,

Fisrt of all its a great framework..For those who have troubled with making their own markers and add them to the project to actually detect that marker.

http://flash.tarotaro.org/blog/2008/12/14/artoolkit-marker-generator-online-released/

1. From the above link you can create custom markers.

2. Add those pattern files in the res/raw directory. (For ex: mymarker.pat)

3. Add these lines in the CustomActivity? class in the project folder,

someObject = new CustomObject?("mymarker", "mymarker.pat", 80.0, new double{0,0}); artoolkit.registerARObject(someObject);

Hope this helps.

Comment by mailpat...@gmail.com, Mar 5, 2012

Hi, is there a way to customize the interface? what i want is to add a button over the camera feed. i see that the view is created in the AndARActivity class, but how do i customize it?

thanks in advance :)

Comment by mailpat...@gmail.com, Mar 9, 2012

Hi, it is possible to use animated objects?

Comment by yasminda...@gmail.com, Mar 25, 2012

Hi, i am a beginner and trying to develop an app with andar - need to add my own models to sample project. i have the models in sketch-up and if i understood it right i need to export them and write the code/coordinates it manually with opengl es. anyone already managed to a make something similar? it would be great if somebody could share the source code. thanks in advance

Comment by zanthe...@gmail.com, Apr 16, 2012

Hi, i'm doing the same that yasminda if anyone can help i would be very grateful! thanks!

Comment by sanch...@gmail.com, Apr 22, 2012

I'm trying to compile the project. When I try to run it in a Asus Transformer or in AVD's on Eclipse, the application stops run inmmediately. Can I look somewhere to try to understand where is the error?

Thanks in advance.

Comment by hadia...@gmail.com, May 21, 2012

same here


Sign in to add a comment
Powered by Google Project Hosting