Android Augmented Reality: Introduction of Vuforia SDK
The Vuforia™ SDK allows you to build vision-based augmented reality applications. It is available for Android, iOS and as an Extension to Unity – a cross-platform game engine.
High-level system overview
- Multiple trackables (tracking types):
- Image Targets
- Multi-Targets
- Cylinder Targets
- Word Targets
- Frame Markers
- Real-world Interactions
- Virtual Buttons
1. Setup Vuforia SDK v2.6
I assume that you already have Android SDK and NDK setup in computer.
Step 1: Download Vuforia SDK v2.6 For Android: https://developer.vuforia.com/resources/sdk/android
Step 2: Extract vuforia-sdk-android-2-6-10 in desire folder
Step 3: Download Samples from following link: https://developer.vuforia.com/resources/sample-apps
Step 4: Extract sample zip file vuforia-sampleapps-android-2-6-7
Step 5: Copy all samples from extracted folder and paste in <vuforia_sdk>/samples folder. <vuforia_sdk> is directory location where you extracted SDK in step 2
2. Compile and execute ImageTargats sample app
Sample has NDK and SDK coding, so normally I compile NDK from terminal and SDK using eclipse
Step 1: Open Terminal & go to <vuforia_sdk>/sample/ImageTargats-2-6-7/,
Step 2: Execute “ndk-build” to compile NDK code, make sure you have environment variable which point to Android NDK directory otherwise terminal will give you “comment not found” error
Step 3: Open eclipse and import ImageTargats-2-6-7 project
Step 4: Set class path variable in eclipse
- In Eclipse, go to Window->Preferences.
- Navigate to Java->Build Path->Classpath Variables using the hierarchy browser.
- Create a new variable by selecting New…
- Add: QCAR_SDK_ROOT into the Name: field, and navigate using Folder… to the vuforia-sdk-android-xx-yy-zz directory
Step 5: Right click on “ImageTargats” project -> select run -> Android Application
Step 6: Take Print of target image: https://developer.vuforia.com/sites/default/files/sample-apps/targets/imagetargets_targets.pdf
Step 7: Open ImageTargets Android application in device and place device in front of printed target image, you will see nice 3d teapot
3. Understand code of ImageTargats app
Files & Description
- SDK
- AboutScreen.java: Display about content, start ImageTarget activity
- DebugLog.java: Exposes functionality for logging, support class for logging
- ImageTargets.java: This class is responsible for almost everything (i.e. managing camera, surface view for rendering, loading texture, etc)
- ImageTargetsRenderer.java: extends GLSurfaceView.Renderer which is used to render OpenGL graphics, this class is also act as bridge between native code and java code, actual rendering is happening in native code using “renderFrame()” method
- ImageTargetsSplashScreen.java: display simple image for 2000 milliseconds and open Aboutscreen.java activity
- QCARSampleGLView.java: This class extends GLSurfaceView, it is responsible for setting up and configuring the OpenGL surface view.
- Texture.java: Texture is a support class for the QCAR samples applications, It load texture image from asset to memory
- NDK
- Android.mk: standard android build script for module
- Application.mk: standard android build script for application
- CubeShader.h: Defines OpenGL shaders as char* strings. OpenGL Shading Language (abbreviated: GLSL or GLslang), is a high-level shading language based on the syntax of the C programming language. It was created by the OpenGL ARB to give developers more direct control of the graphics pipeline without having to use ARB assembly language or hardware-specific languages. More.
- ImageTargets.cpp: It is used to bridge between native and java code, This class has JNI methods, “startCamera” method actually start capturing frame from camera and identify tracker using QCAR tracker manager API
- SampleUtil.h/cpp: A utility class which define common & static function like printMatrix, checkGLError, setRotationMatrix…
- Teapot.h: This class define teapot OpenGL co-ordinate, vertices and indices,Vuforia API only identify marker, for content we can use OpenGL, Content generation and display is most important part of Augmented Reality, I personally thing that Metaio has more robust and powerful content generation system.
- Texture.h/cpp: another utility class, It load Texture buffer from Texture.java object.
hi thank you for your tutorial, but i am getting this error:
ndk-build is not recognized as an internal or external command. please help
thank you
Hello Cess,
You need to set environment variable. Following links will help you
1. For Mac
http://stackoverflow.com/questions/15214835/error-in-ndk-build-comment-on-terminal-mac
2. For Ubuntu
http://stackoverflow.com/questions/14891399/ndk-build-command-not-found-in-ubuntu-terminal
Nice is it open source is there any licencing issues to using it .And its comes under which licence.
hi, when i run the native samle image target app it displays the about page with the start button but when i click on the start it shows an error “unfortunately, ImageTarget has stopped” plz help me in this..
/sample/ImageTargats-2-6-7/,
i do not see ImageTargats folder on sample folder
me too same problem
Android studio version for this please. thank you.