About 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

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.

Do you want to know how to develop your skillset to become a Java Rockstar?

Subscribe to our newsletter to start Rocking right now!

To get you started we give you two of our best selling eBooks for FREE!

JPA Mini Book

Learn how to leverage the power of JPA in order to create robust and flexible Java applications. With this Mini Book, you will get introduced to JPA and smoothly transition to more advanced concepts.

JVM Troubleshooting Guide

The Java virtual machine is really the foundation of any Java EE platform. Learn how to master it with this advanced guide!

Given email address is already subscribed, thank you!
Oops. Something went wrong. Please try again later.
Please provide a valid email address.
Thank you, your sign-up request was successful! Please check your e-mail inbox.
Please complete the CAPTCHA.
Please fill in the required fields.

4 Responses to "Android Augmented Reality: Introduction of Vuforia SDK"

  1. cess says:

    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

  2. Abhi says:

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

  3. ahsan says:

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

Leave a Reply


× six = 36



Java Code Geeks and all content copyright © 2010-2014, Exelixis Media Ltd | Terms of Use | Privacy Policy | Contact
All trademarks and registered trademarks appearing on Java Code Geeks are the property of their respective owners.
Java is a trademark or registered trademark of Oracle Corporation in the United States and other countries.
Java Code Geeks is not connected to Oracle Corporation and is not sponsored by Oracle Corporation.
Do you want to know how to develop your skillset and become a ...
Java Rockstar?

Subscribe to our newsletter to start Rocking right now!

To get you started we give you two of our best selling eBooks for FREE!

Get ready to Rock!
You can download the complementary eBooks using the links below:
Close