Android Core

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

source : https://developer.vuforia.com/resources/api/index
source : https://developer.vuforia.com/resources/api/index

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

Screen Shot 2013-09-19 at 6.32.46 PM

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.

 

Reference: Android Augmented Reality: Introduction of Vuforia SDK from our JCG partner Ketan Parmar at the KP Bird blog.

Ketan Parmar

Ketan Parmar (aka KPBird) is software engineer with 7 years experience, He is passionate about Java (SE,EE,ME),Android,BlackBerry, Grid Computing, Big Data, UI/UX and Open Source
Subscribe
Notify of
guest

This site uses Akismet to reduce spam. Learn how your comment data is processed.

7 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
cess
cess
10 years ago

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

Ketan Parmar
10 years ago
Reply to  cess
Abhi
Abhi
10 years ago

Nice is it open source is there any licencing issues to using it .And its comes under which licence.

ahsan
ahsan
9 years ago

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

huy
huy
8 years ago

/sample/ImageTargats-2-6-7/,
i do not see ImageTargats folder on sample folder

yashaswini
yashaswini
6 years ago
Reply to  huy

me too same problem

Muhammad Catubig
Muhammad Catubig
7 years ago

Android studio version for this please. thank you.

Back to top button