|
HowToBuildApplicationsBasedOnAndAR
This page describes how someone can build augmented reality applications using AndAR.
LicenseThe 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 HowtoThis 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. |
I'm really impatient to try this =)
I'm really busy writing my exams right now. so you have to wait like a week or so, sorry :/
no problem ^^ Good luck for your exams
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
Hey, tdomhan, ur project looks very awesome. good luck for ur exam and I also look forward to see ur sample Eclipse project.
Please notify when eclipse project sample is updated, thanx
Also waiting for it :)
alright here you go, feel free to ask any questions ;)
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?
mh maybe the new version of the SDK is producing those errors. My version is a bit outdated. I'm going to update now.
alright, I uploaded a new version that works with the new SDK. I hope everything works, if not just say so :D enjoy!
problem [2010-05-31 09:09:54 - AndARSampleProject] Android requires .class compatibility set to 5.0. Please fix project properties.
sorry im noob
a update to the newest SDK should solve your issue
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
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.
@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?
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! :)
@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
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!
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.
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.
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.
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.
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.
Sorryyy it is solved now....
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!!
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....
Hi,
is it possible to create something like this
with AndAR?
Alex
hi all. anyone could give a tutorial for replacing the 3D cube to my 3d model?
could anyone tell me how to replace the green box to my own model??/ thx
Hi, How could I use a socket camera to run the AndAR in emulator on PC?
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 !
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!
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.
Hello! Is there any device specification requirements like processor speed, etc for this application? Thank you in advance.
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
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.
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
Can anyone guide me on how to draw or overlay the texture using AndAR? I cant figure it out!
hi tdomhan,
How can I replace the 3D cube with the simple text...Please help out
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...
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.
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 :)
Hi, it is possible to use animated objects?
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
Hi, i'm doing the same that yasminda if anyone can help i would be very grateful! thanks!
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.
same here