Sunteți pe pagina 1din 184

Qualcomm Austria Research Center GmbH Operngasse 17-21, A-1040 Vienna, Austria www.qualcomm.

com

QCAR 1.5 Beta1 SDK and Unity Extension for Android


Transition guide for QCAR 1.5 Beta1 Android developers

QCAR 1.5 Beta1 SDK and Unity Extension for Android brings several changes that improve performance, provides the developer greater flexibility in managing trackables and gives access to the video background.

Date: Version:

December 6, 2011 1.5 Beta1 for Android

Table of Contents
1 Introduction to QCAR SDK 1.5 Beta1 for Android .......................................................... 4 1.1 1.2 2 Overview ............................................................................................................... 4 Document usage ................................................................................................... 4

Native SDK for Android .................................................................................................. 5 2.1 2.1.1 2.1.2 2.1.3 2.1.4 2.2 2.2.1 2.2.2 2.3 2.3.1 2.3.2 2.3.3 2.3.4 2.3.5 2.3.6 Getting Started ...................................................................................................... 5 Using the On-Line Documentation ..................................................................... 5 Step 1: Setting up the Development Environment .............................................. 5 Step 2: Installing the QCAR SDK ..................................................................... 13 Step 3: Compiling & Running a QCAR Sample App ......................................... 19 QCAR Native SDK API Changes ......................................................................... 25 New API .......................................................................................................... 25 Modified API .................................................................................................... 30 Migrating your project from QCAR 1.0.6 to QCAR 1.5 Beta1 ............................... 34 AndroidManifest.xml ........................................................................................ 34 Android.mk ...................................................................................................... 34 Eclipse Project Settings ................................................................................... 34 config.xml and qcar-resources.dat ................................................................... 35 Native Application C++ code (e.g. ImageTargets.cpp) ..................................... 35 Native Application Java code (e.g. ImageTargets.java).................................... 36

Unity Extension for Android .......................................................................................... 39 3.1 3.1.1 3.1.2 3.1.3 3.2 3.2.1 3.2.2 3.3 Getting Started .................................................................................................... 39 Step 1: Installing the Extension ........................................................................ 39 Step 2: Compiling a Simple Project .................................................................. 40 Mastering Advanced Topics ............................................................................. 48 Unity SDK API Changes ...................................................................................... 59 Default Handlers .............................................................................................. 59 Datasets .......................................................................................................... 59 Upgrading a QCAR 1.0.6 Unity Project to QCAR 1.5 ........................................... 65

DevGuide changes ...................................................................................................... 67 4.1 4.1.1 4.1.2 4.1.3 Swap Dataset at Runtime .................................................................................... 67 Config.xml Definitions ...................................................................................... 67 Active Trackable Code Fragment ..................................................................... 67 Loading Dataset Code Fragment ..................................................................... 68

Page 2 of 73

4.2 4.2.1 4.2.2 4.3 4.3.1 4.3.2 4.3.3 5

Frame Markers .................................................................................................... 69 Definition.......................................................................................................... 69 Creation in QCAR SDK 1.5 Beta1 and Code Fragment ................................... 69 Samples .............................................................................................................. 70 Overview.......................................................................................................... 70 ImageTargets .................................................................................................. 70 BackgroundTextureAccess .............................................................................. 71

Appendix QCAR Public API documentation .............................................................. 73

Page 3 of 73

1 Introduction to QCAR SDK 1.5 Beta1 for Android 1.1 Overview


The QCAR SDK 1.5 Beta1 and the QCAR Unity Extension introduces several changes to the 1.0 API, but in general retains the same functionality to detect and track trackables. New features like loading target datasets at runtime and several performance improvements to tracking robustness, and speed were made. Features of the QCAR SDK 1.5 Beta1 for Android include: Swappable datasets allows a an app to dynamically load a previously created dataset based on some application level trigger Streamlined access to the video background texture to apply custom shaders for special visual effects, Detecting targets at steeper angles Improved robustness during tracking with less likelihood of losing targets Better pose estimate yielding more accurate tracking Less jitter in the pose calculation resulting in a more stable augmentation, Improved detection and tracking of Frame Markers, Faster QCAR system start-up times.

NOTE: This documentation and the QCAR SDK 1.5 Beta1, as well as the QCAR Unity Extension 1.5 Beta1 software packages are for Android only. NOTE: If you have been developing applications with previous versions of the QCAR SDK or the QCAR Unity Extension you must apply several small changes to your existing project to make it compatible with the QCAR SDK 1.5 Beta1 and the QCAR Unity Extension. Please carefully review the corresponding section of this document for the full list of changes.

1.2 Document usage


This document contains four main sections: Native SDK for Android use this if you are developing with the native QCAR SDK Unity Extension for Android use this if you use the QCAR Unity Extension DevGuide changes this section summarizes the modifications to the DevGuide Public API the appendix contains the updated public API documentation off-line

The beginning of the Native SDK and Unity Extension sections contains the updated Getting Started guide. It follows the same structure as published previously on the Developer Portal: https://ar.qualcomm.at/qdevnet/sdk. To ease your transition locating the subtle differences, we have highlighted the changes throughout the Getting Started sections. After the Getting Started guide you will find new and modified functionality explained. Deprecated API is marked with strikethrough. A step-by-step migration guide wraps up each of the first two sections to help transitioning your existing applications from QCAR 1.0 to the QCAR 1.5 Beta1.

Page 4 of 73

2 Native SDK for Android 2.1 Getting Started


If you are an Android developer and already have the Android SDK and NDK installed, then please go directly to Step 2: Download and install the QCAR SDK. If you are new to Android software development, you will find it very useful to start at Step 1 below. 1. Setting-up the development environment 2. Installing the QCAR SDK 3. Compiling & Running a QCAR sample app If you have used the QCAR SDK in the Beta phase you might want to check the section on application publishing. Note that several changes have been applied to the environment setup and some API features that you should revisit.

2.1.1 Using the On-Line Documentation


The first step for both newcomers and experienced AR developers is to follow the Getting Started guide above and run a QCAR sample app. After that, depending on your skill and comfort level with AR, you may go directly to one of the following options:

If you are familiar with the concepts of vision based augmented reality, then you can look at the Developer Guide to learn more about QCAR SDK features. If you are a "No text - unless it starts with //" type of person, then the API Reference is the right place for you!

2.1.2 Step 1: Setting up the Development Environment


Supported Development Platforms

The QCAR SDK supports Android OS 2.1 and above. The recommended development environment is Microsoft Windows 7 32/64bit or Windows XP. The components to build the actual code (JDK, Eclipse+ADT and gcc) are available across multiple platforms. While building on Linux Ubuntu and Mac OS X environments is possible, we will be unable to support those platforms with detailed documentation. However, we have included hints and notes to platform specific issues that will help you set up your development environment on Linux Ubuntu 11.10 or Mac OS X 10.6 (Snow Leopard). This set-up guide has been written for the Win7 32/64bit platform with special notes for other operating systems. NOTE: If you already have both the Android SDK and the NDK setup, then please go directly to Step 2: Installing the QCAR SDK.

Page 5 of 73

Set-up the Android Development Environment

The QCAR SDK requires both the Android SDK and the NDK. The Android NDK is an extension to the Android SDK that lets Android developers build performance-critical parts of their applications in native code. SDK and NDK communicate over the Java-Native-Interface (JNI). To set-up the development environment please install the following components in the order they appear below: 1. 2. 3. 4. 5. 6. 7. JDK Eclipse IDE Android SDK Downloader Android ADT Android SDK platform support Cygwin Environment Android NDK

We recommend to use the following versions of the above listed tools with the QCAR 1.5 Beta1 SDK: Java SE Development Kit: use version Java SE 7u1 Eclipse: use latest version Android SDK Downloader: use version Android SDK Tools revision 15 Android ADT: choose the latest version that is for SDK tools rev 15 Android SDK Platform Support: use Android SDK Platform-tools revision 9 Cygwin Environment: use latest version 1.7.9-1. Android NDK: use version Android NDK 7

2.1.2.1 JDK Download the Java SE Development Kit (JDK) from the following site: http://www.oracle.com/technetwork/java/javase/downloads/ Click the 'Download' button from the JDK section of the 'Java Platform, Standard Edition' table. Install the JDK environment with default settings. Detailed installation instructions and system requirements can be found at: http://www.oracle.com/technetwork/java/javase/index-137561.html MAC: The JDK is already integrated into the Mac OS X operating system.

Page 6 of 73

2.1.2.2 Eclipse IDE In this step you will install the Eclipse IDE. Download the latest version of Eclipse IDE for Java Developers from: http://www.eclipse.org/downloads/ Unpack the downloaded ZIP package and copy the contents of the archive starting with the subdirectory 'eclipse' to your program directory path in C:\Program Files\eclipse. You may also create a shortcut to eclipse.exe on your desktop or start menu. Start eclipse.exe The very first time that Eclipse is started, the IDE will ask you to assign storage space for your workspace. This directory will contain ONLY IDE specific settings and information. This is not your application development workspace (despite the notice in this window). This type of information is typically stored in the user's home directory, which is the default value here: C:\Users\USERNAME\workspace. Check "Use this as the default and do not ask again".

MAC: For Mac OS X we recommend that you use the 32-bit version of Eclipse. LINUX: Eclipse is not always able to determine the location of the JVM, despite being in the path, To fix this, insert into <path-to-eclipse-dir>/eclipse.ini the following line at the top:
-vm <path-to-JVM>

For example:
-vm /usr/bin/java

2.1.2.3 Android SDK Downloader The Android SDK is distributed through an SDK starter package containing the SDK Tools. Download the starter package from: http://developer.android.com/sdk/index.html Unzip the archive and copy the contents into a directory, Ex. :\Development\Android\android-sdk-windows\. Throughout the Get Started guide we will refer to the base directory of your development environment as
<DEVELOPMENT_ROOT>= C:\Development\Android

NOTE: Do not use pathnames with spaces.

Page 7 of 73

Add the tools\ directory to your Windows path. Right-click on Computer on the desktop and select Properties. Use the Advanced system settings to open the System Properties window and select Environment Variables on the Advanced tab. Look for variable Path in the System variables window. After pressing Edit, scroll to the end of Variable value: and add the full path to the tools\ directory to the end of the path, separated by a semicolon from the one before. For example:
;C:\Development\Android\android-sdk-windows\tools\

NOTE: The last "\" at the end of the Path variable has to be included. Android ADT installation in the next step will use this path to identify the Android development environment.

Troubleshooting

For troubleshooting Android related issues and for more detailed instructions on the Android SDK set-up, please refer to the following:

Quick Start Android SDK set-up Installing the Android SDK

MAC: Update PATH variable to point to the make utility and the Android SDK tools directory in the /etc/rc.common or ~/.bash_profile file:
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/libexec:/System/Library/CoreS ervices:/Developer/usr/bin:~/Development/Android/android-sdkmacosx/tools;export PATH

LINUX: Update your PATH to point to the Android SDK tools directory. If you use bash shell, add the following to ~/.bashrc :
export PATH=/opt/android-sdk-linux/tools/:$PATH

2.1.2.4 Android ADT Android Development Tools (ADT) is a powerful extension to Eclipse that connects it with the Android SDK and helps with app development. This package is installed from within Eclipse. Select Help->Install New Software... . Add the url https://dl-ssl.google.com/android/eclipse/ into Work with field. Eclipse will ask you to provide an arbitrary name for the update site. After a short while Developer Tools appears in the field. At the very minimum, please select Android Development Tools and Android DDMS - which adds debugging support from the list, and then click on Next-> .

Page 8 of 73

Eclipse component selection After reviewing this selection and accepting the license terms, the downloader fetches the files and puts them in your Eclipse directory. After accepting the certificate and an automatic restart of Eclipse, the installation of the Android ADT is complete. 2.1.2.5 Android SDK Platform Support To develop for Android, support for the appropriate Android platform must be installed. The Android SDK Manager is used to install additional components and support for different platforms. Select in Eclipse the menu Window->Android SDK Manager. In case the Android SDK location was not setup correctly within Eclipse, go to Window->Preferences>Android and set the SDK location field to the root of your SDK install directory. In the Android SDK Manager window, sort by API level, click Deselect All, and check the following boxes:

Page 9 of 73

From Tools:

Android SDK Platform-tools

From Android 4.0 (API 14):

Documentation for Android SDK

From Android 2.2 (API 8):

Samples for SDK (optional)

From Android 2.1 (API 7):

SDK Platform

From Extras:

Google USB Driver package (not compatible with Linux)

Android SDK component selection To install the selected options you must hit Install 5 packages and accept all licenses on the next window. Use Accept All as a shortcut and hit Install.

Page 10 of 73

Android component license acceptance Finally, add the platform-tools\ directory to your Windows path:
;C:\Development\Android\android-sdk-windows\platform-tools\

NOTE: The last "\" at the end of the Path variable has to be included. MAC: Update PATH variable to point to the Android SDK Platform-tools directory in the /etc/rc.common file or ~/.bash_profile:
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/libexec:/System/Library/CoreS ervices:/Developer/usr/bin:~/Development/Android/android-sdkmacosx/tools:~/Development/Android/android-sdk-macosx/platformtools:export PATH

LINUX: Update your PATH to point to the Android SDK Platform-tools directory. If you use bash shell, add the following to ~/.bashrc :
export PATH=/opt/android-sdk-linux/tools/:/opt/android-sdklinux/platform-tools/:$PATH

The Eclipse environment is now ready for Android development.

Page 11 of 73

2.1.2.6 Cygwin Environment LINUX: This section is not relevant for Linux users who have GNU make installed and in their path. MAC: This section is not relevant for Mac users who have Apple Developer Tools (XCode) installed. Install XCode if necessary from http://developer.apple.com/xcode/. A GNU compiler is required to compile dynamic applications as shared libraries for the Android NDK. Android make files are designed to run with gcc4. On Windows, a convenient way to have the complete environment prepared for this, is to install Cygwin.
Cygwin uses an installer helper to manage the installation process. Go to http://www.cygwin.com/setup.exe and select "Install from Internet" when prompted at "Choose a Download Source" in the installer. We recommend not changing the Root Directory in the next window, and leaving it at "C:\cygwin". The "Local Package Directory" holds the downloaded packages. You may want to keep them with the downloaded Setup.exe in the same directory so as to have a Cygwin installer directory.

Choose a download site with a known fast connection near you. When the package information is downloaded you will see a hierarchical browser to select packages. Select the following package from the hierarchy for download:
All -> Devel -> "make: The GNU version of the 'make' utility"

Select the word "skip" to change it to the actual version number, which is currently 3.81-2. Finish the installation by clicking next. Your Cygwin environment is fully set-up to work with the QCAR SDK. If you have other similar environments installed, make sure to set your Windows path variable to point to "C:\cygwin\bin" so that bash uses this version of GNU's make.exe. 2.1.2.7 Android NDK The Android NDK is an extension to the Android SDK that lets Android developers build performance-critical parts of their applications in native code. Download the NDK package from: http://developer.android.com/sdk/ndk/index.html Unzip the archive and copy the contents into a directory. To be consistent with our previous setup we recommend that you put the contents in "C:\Development\Android\androidndk-r7\". Thus Android SDK and Android NDK share the same parent directory. We will later add the QCAR-SDK and your project files here. NDK requires the above directory to be added to the Windows path! To do this right-click on 'My Computer' on the desktop and select properties. On the 'Advanced' tabs select 'Environment Variables' and look for Variable 'Path' in the 'System variables' window. After pressing 'Edit', scroll to the end of 'Variable value:' and add the full path to the directory to the end of the path, separated via semicolon from the one before.

Page 12 of 73

In the above example, you would have to add:


;C:\Development\Android\android-ndk-r7\

NOTE: Path has semicolon at the beginning. Do not use pathnames with spaces. Alternatively, you can also set a User variable with the name Path, but this is only valid for the current user. The last "\" at the end of the Path variable has to be included. To test your installation you can compile any of the NDK sample applications. Using a Cygwin bash shell, navigate to the root directory of any demo application (e.g. for the 'sanangeles' sample app with out installation path above):
cd /cygdrive/c/Development/Android/android-ndk-r7/samples/san-angeles ndk-build

The compiler should produce a dynamically linked library libsanangeles.so and write it to /libs/armeabi within the application directory. NDK includes support for different architectures so you might find different subdirectories in /libs. Now your development environment is ready to host QCAR SDK related content. MAC: Update PATH variable to point to the Android NDK directory in the /etc/rc.common file or ~/.bash_profile:
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/libexec:/System/Library/CoreS ervices:/Developer/usr/bin:~/Development/Android/android-sdkmacosx/tools:~/Development/Android/android-sdk-macosx/platformtools:~/Development/Android/android-ndk-r7:export PATH

LINUX: Update your PATH to point to the Android NDK Platform directory. If you use bash shell, add the following to ~/.bashrc :
export PATH=/opt/android-sdk-linux/tools/:/opt/android-sdklinux/platform-tools/:/opt/android-ndk-r7/:$PATH

2.1.3 Step 2: Installing the QCAR SDK


Clean Installation

QCAR SDK is distributed using installers for the following platforms: Windows, Mac OS X, and Linux. To start developing with the QCAR SDK you will need to,

Download & Install QCAR-SDK under <DEVELOPMENT_ROOT>. Adjust QCAR Environment settings in Eclipse.

Page 13 of 73

After accepting the license agreements the installer creates a directory structure in your Android development environment. This structure will ensure that sample apps can be easily built and deployed using the Android NDK and the Eclipse Java developer environment.
Upgrading from a Previous Version

When installing an updated version of the QCAR SDK, we suggest that you install it under a new directory tree, just as the installer recommends. To compile the new set of sample applications it is required to adjust the Eclipse workspace variable setting. Lastly you will need to move your projects under the new <DEVELOPMENT_ROOT> (see below).
Resulting Directory Structure

To streamline development we have designed a directory structure that keeps the QCARSDK and your applications in separate trees. This will ensure easier updates to the SDK, leaving your application source-trees untouched. In the previous steps we used a starting directory for the SDK and the NDK installation that we called:
<DEVELOPMENT_ROOT>= C:\Development\Android

The downloaded installer creates a directory structure that will integrate into your Android development environment. Following the recommended installation location the development environment should finally result in the structure below. Here xx-yy-zz and xx.yy.zz stand for the version number of the QCAR SDK.

<DEVELOPMENT_ROOT>\ android-ndk-r7\ android-sdk-windows\ qcar-android-xx-yy-zz\ build\ licenses\ samples\ assets\ readme.txt

QUALCOMM Augmented Reality SDK License Agreements Sample applications with full source code Additional assets for the QCAR SDK Starting read-me document

Page 14 of 73

2.1.3.1 Install the QCAR SDK


Download

QCAR SDK is distributed through the Qualcomm Augmented Reality Developer Platform site. Follow the instructions below to access the installer. NOTE: Although we distribute installers for the platforms listed below, support for QCAR SDK development is limited to the Win 7 32/64 bit platform.
Windows

Although we recommend that you develop on Windows 7 32/64-bit or Windows XP 32-bit environments, the QCAR SDK has also been successfully run on Windows XP 64-bit. However, we currently do not offer specific support for this platform. 1. Download installer EXE-file from the Downloads page. 2. Run installer
Mac OS X

Installation has been tested on Mac OS X 10.6. 1. Download archive file from the Downloads page. 2. Unarchive and run installer
Linux

Installation has been tested on Ubuntu 11.10. 1. 2. 3. 4. 5. Requires JVM to be installed Download the installer file from the Downloads page. Open terminal window and change directory to the installer file location Change the mode of the installer to be executable Execute the installer file on the command line

Page 15 of 73

2.1.3.2 Set the QCAR Environment Variable Our recommended directory structure allows for SDK upgrades independent of application development. Your future AR projects will be in the recommended structure under <DEVELOPMENT_ROOT>. One workspace variable must be set in Eclipse so that is aware of this hierarchy: 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 <DEVELOPMENT_ROOT>\qcarandroid-xx-yy-zz directory we defined in the QCAR SDK Setup section. In our example above the variable value is
C:\Development\Android\qcar-android-xx-yy-zz

where xx-yy-zz denotes the current QCAR SDK version number. This setting is essential as the classpath settings in the sample files use this reference to include common shared JAR files. MAC: The preferences menu on Mac OS X is under Eclipse->Preferences.

Page 16 of 73

2.1.3.3 Prepare Test Device for Development


Developer Settings on the Device

Android devices require special settings for development. In this step we will:

Allow apps to be installed from unknown sources Enable USB debugging

On the device, go to Settings->Applications and choose "Unknown sources" as shown below. Accept the warning shown on the right. This setting allows the direct installation of unsigned APKs from within Eclipse.

Allowing unknown sources for software installation Go to the Development dialog on the above screen and choose the two settings as shown below:

Page 17 of 73

USB debugging is mandatory. The stay awake setting will help with development.
Install the USB Driver

Connect your device to the development PC via the USB cable. On initial connection, Windows will recognize the new device and attempt to locate a compatible a driver. The Android SDK already includes some USB drivers - others will have to be obtained directly from the device manufacturer. SDK pre-packaged drivers can be located in the following directory:
<DEVELOPMENT_ROOT>\android-sdk-windows\extras\google\usb_driver

When the device installation finishes you are ready to use your test device. On some machines the USB driver installation will ask you to reboot the machine. You can skip this step and the device should be accessible without a reboot. NOTE: You should contact the device manufacturer to insure that you are using the correct USB driver.

Page 18 of 73

2.1.4 Step 3: Compiling & Running a QCAR Sample App

We are now going to build a sample application included in the QCAR SDK package. The ImageTargets application is a good place to start learning about the SDK as it shows detection and tracking of natural features using common images. This section will show you how to build the native C++ source files with the NDK package of the Android SDK and then use Eclipse to build the Java sources and create the APK package that can be deployed to the device.

2.1.4.1 Compile the Shared Object


Compile the Shared Object with Application Code

Android NDK applications are deployed as shared objects with a Java bootloader. In this step we create the binary *.so file that is later packaged through Eclipse. For each sample app you will need to build the application *.so separately.
Build ImageTargets shared library

Change directory to ImageTargets in the <DEVELOPMENT_ROOT>\qcar-android-xx-yyzz\samples directory and execute


ndk-build Gdbserver Gdbsetup Gdbserver Gdbsetup Compile++ arm : : : : [arm-linux-androideabi-4.4.3] libs/armeabi/gdbserver libs/armeabi/gdb.setup [arm-linux-androideabi-4.4.3] libs/armeabi-v7a/gdbserver libs/armeabi-v7a/gdb.setup : ImageTargets <= ImageTargets.cpp

Page 19 of 73

Compile++ arm Compile++ arm StaticLibrary Prebuilt SharedLibrary Install Install Compile++ arm Compile++ arm Compile++ arm StaticLibrary Prebuilt SharedLibrary Install Install

: : : : :

: : : : :

: ImageTargets <= SampleUtils.cpp : ImageTargets <= Texture.cpp libstdc++.a libQCAR.so <= jni/../../../build/lib/armeabi/ libImageTargets.so libImageTargets.so => libs/armeabi/libImageTargets.so libQCAR.so => libs/armeabi/libQCAR.so : ImageTargets <= ImageTargets.cpp : ImageTargets <= SampleUtils.cpp : ImageTargets <= Texture.cpp libstdc++.a libQCAR.so <= jni/../../../build/lib/armeabi-v7a/ libImageTargets.so libImageTargets.so => libs/armeabi-v7a/libImageTargets.so libQCAR.so => libs/armeabi-v7a/libQCAR.so

We are now ready to compile the Java bootloader and deploy the application.

2.1.4.2 Create the Android APK In the previous step, we created the shared object for the ImageTargets sample app. We must now compile and build the Android application APK using the Eclipse IDE environment. The sample applications have several Java classes to create the bootloader, provide GUI functionality, read the orientation sensor of the device, allow user interaction, and provide video background for the app.
Building the ImageTargets application

Create a new project in Eclipse by selecting File->New->Project.... Choose Android>Android Project from the Wizard selection and click next. Select 'Create project from existing source' and browse to the <DEVELOPMENT_ROOT>\qcar-android-xx-yyzz\samples\ImageTargets directory. Click Finish.

Page 20 of 73

Eclipse "New Android Project" panel The standard installation of Eclipse has automatic compilation turned on. The very first time you compile the app, you may receive some error messages from Eclipse. Project>Clean...->Clean All Projects should fix these errors as Eclipse has to build some standard directories. This also creates the APK package for deployment.

2.1.4.3 Run the Sample Application


Print the Image Target

Print all image targets in <DEVELOPMENT_ROOT>\qcar-android-xx-yyzz\samples\ImageTargets\media from any of the formats onto a US Letter or A4 sized paper with the page scaling 'none' option, keeping the original aspect ratio of the image intact.

Page 21 of 73

"chips" Image Target

"stones" Image Target

tarmac Image Target


Deploy & Run the Application

With the device connected, select the "ImageTargets" project from the Package Explorer in Eclipse and choose Run->Run As-> Android Application. Eclipse automatically installs it to a connected Android device using ADB, and starts running it on the device. Now when you hold your device up against the printed chips target, you should see the following image:

You have successfully deployed your first application with the QCAR-SDK!

Page 22 of 73

After a splash screen the live camera image is shown. Use your device to look at the printed target. You should see a textured teapot centered on top of the target, registered to the plane. Next, press the menu button, and select Switch to Tarmac dataset, and then hold your device up against the tarmac printed target and you will see the teapot, only now it is orange. The ImageTargets app shows how the SDK can detect and track a single image from a predefined set of images. The app also shows how to switch between datasets without too much effort, as well as how to deal with camera settings, such as autofocus. With a small code change, it can also be compiled to detect and track multiple images simultaneously. Check the Tips & Tricks section in the Developer Guide for more information on this.
Troubleshooting

Should you encounter problems on the installation, check the device connection settings in Prepare Test Device for Development. In Eclipse, you can see if the device is connected correctly via the ADB in the DDMS panel (Window->Open Perspective->DDMS). The device must be listed under 'Devices'. Alternatively, open a Cygwin bash shell and execute
adb devices

The output should show the attached device:


$ adb devices List of devices attached HT012P123456 device

If the device list is empty, or a given device is not listed, kill the ADB server by executing
adb kill-server

Executing 'adb devices' again will restart the server and re-detect devices. 2.1.4.4 Publish Your Application Once you have successfully finished developing your own application, you may distribute it through an app store such as the Android Market. NOTE: The QCAR SDK license agreement contains certain responsibilities that you as a developer must follow when distributing apps. You must inform end-users of your application that certain types of anonymous usage data is collected by the QCAR SDK and sent back to Qualcomm servers. For further details, please see the license agreement, which is available at https://ar.qualcomm.at/legal/license and in particular (but without limitation) note the requirements of Section 8 thereof, which specifically requires that you include, in a mandatory end-user license agreement for each of your applications, a clause whereby the end-user unconditionally and irrevocably expressly consents to:

Page 23 of 73

(i) the collection by QUALCOMM and/or its affiliates of Statistics from the Software (including but not limited to: (a) information about the end users' devices such as device unique identifier, make, model, operating system name and version and kernel version, (b) information about our Software used to create your software or augmented reality end user application such as the SDK version and device profile, and (c) information about your software or augmented reality application and its use such as settings (e.g., camera resolution settings, configuration settings), start and stop dates and times, camera on/off events, target image obtained/lost events, and other general usage information (collectively "Statistics")). (ii) the transfer of Statistics to QUALCOMM and/or its affiliates in the United States for QUALCOMM and/or its affiliates to (a) facilitate the provision of new products, updates, enhancements and other services, (b) to improve the Software and our products, services and technologies, and (c) to provide new products, services or technologies to You and/or our customers.

Page 24 of 73

2.2 QCAR Native SDK API Changes


This section details the changes that were applied to the QCAR Native SDK API. Some new functions were created, and some existing functions were updated or deprecated.

2.2.1 New API


2.2.1.1 QCAR::TrackerManager In QCAR SDK 1.0 access to all types of trackables was provided via the Tracker singleton. A more streamlined and decoupled approach is introduced with QCAR SDK 1.5 Beta1, where the TrackerManager class allows initialization and de-initialization of different trackers independently. This change allows trackers to be turned on/off as required by the application and thus saves memory and improves performance. Two independent trackers now track the different trackable types. Image Targets and Multi Targets are handled by the ImageTracker class, the Frame Markers are independently accessible via the MarkerTracker class. It is important to highlight that in QCAR 1.5 Beta 1, target dataset generated using the Target Management System is not loaded by the TrackerManager, but by the ImageTracker directly. NOTE: With this change it is also not possible to load a Frame Marker from the configuration file. These must be created at application runtime using the MarkerTracker API. Relevant APIs The TrackerManager API contains the following member functions: virtual Tracker virtual Tracker virtual bool *initTracker (Tracker::TYPE type)=0 *getTracker (Tracker::TYPE type)=0 deinitTracker (Tracker::TYPE type)=0

2.2.1.2 QCAR::DataSet The Swappable Target Dataset feature is supported in a new class. This new class contains Image Targets and Multi Targets and allows runtime loading, enabling, running and disabling groups of trackables. You can load multiple datasets at runtime (up to the application memory space limit). Note that at any given time only one dataset can be active. This active dataset is used by the ImageTracker to find and track targets in the camera image. Note that loading a dataset may take significant time and therefore it is recommended that datasets be loaded in the background. For recommendations on how to switch between datasets refer to the ImageTracker class documentation.

Page 25 of 73

NOTE: with QCAR SDK 1.5 Beta1 you do not have to bundle the dataset explicitly into your app, you can also load it from the SDCard or download it from the Internet at application runtime. Dataset generation The process to generate QCAR 1.5 Beta 1 compatible target dataset that you will use in your application has not changed. Using the Target Management Service (TMS) you upload your images and download a group of trackables as one trackable assets package. NOTE: QCAR SDK 1.5 Beta1 will not load datasets created and downloaded prior to the publication of the Beta! To use your existing targets, you must log-in to the TMS, recreate your project by uploading your images again to create the targets and download your new target datasets again. NOTE: During the beta phase of QCAR SDK 1.5 the functionality of the TMS remains unchanged to support QCAR SDK 1.0 developers. When you plan to use a downloaded dataset with the QCAR SDK 1.5 Beta1 you have to rename the files after opening the trackable assets package. Instructions on how to rename the files are below. The dataset name that is also used in the load() function is myDataset1: rename rename config.xml qcar-resources.dat myDataset1.xml and myDataset1.dat

In the QCAR SDK 1.5 Beta1 version of the Unity Extension a convenience function to accomplish the name change has been added. Refer to Changes to Unity Extension section for details.

Page 26 of 73

Relevant APIs Target dataset load and trackable reference methods available in the Tracker class in QCAR SDK 1.0 have been moved to the new DataSet class in the QCAR SDK 1.5 Beta1. Load the dataset by specifying the path and storage location: virtual bool enum load (const char *path, STORAGE_TYPE storageType)=0 STORAGE_TYPE { STORAGE_APP, STORAGE_APPRESOURCE, STORAGE_ABSOLUTE } The storage types STORAGE_APP, STORAGE_APPRESOURCE allow you to load dataset assets from specific, platform independent root folders. The relative path to the dataset XML must be passed to this function for all storage locations other than STORAGE_ABSOLUTE. Given an existing ImageTracker to create and load a dataset named myDataset1.xml that is placed in the assets/ you would call
QCAR::DataSet* myDataset = 0; myDataset = imageTracker->createDataSet(); if (myDataset == 0) { LOG("Failed to create a new tracking data."); return 0; } if (!myDataset->load("myDataset1.xml", QCAR::DataSet::STORAGE_APPRESOURCE)) { LOG("Failed to load data set."); return 0; }

From the MyApp folder of the SDCard you would load the same dataset using the following piece of code
if (!myDataset->load("/sdcard/MyApp/myDataset1.xml", QCAR::DataSet::STORAGE_ABSOLUTE))

NOTE: Some Android phone models do have different pathnames for the external SDCard storage location, such as /sdcard or /emmc. The QCAR SDK does not abstract the external SDCard location, you must ensure that it is correctly located correctly. Refer to http://developer.android.com/guide/topics/data/data-storage.html for details.

Page 27 of 73

virtual int

getNumTrackables () const =0 getTrackable (int idx)=0

virtual Trackable *

These functions have been moved from the Tracker class to DataSet in QCAR SDK 1.5 Beta1, since you can work with several datasets at a time. The function getNumTrackables() returns the overall number of 3D trackable objects in this dataset. The getTrackable() function returns a pointer to a trackable object in the dataset.

virtual MultiTarget * createMultiTarget (const char *name)=0 virtual bool destroy (MultiTarget *multiTarget)=0

Starting with QCAR SDK 1.5 Beta1 the creation of MultiTargets is performed with the createMultiTarget() function of the DataSet class. This function creates a new MultiTarget and registers it with the dataset. The function destroy() destroys a MultiTarget.

2.2.1.3 QCAR::ImageTracker The ImageTracker class derived from the QCAR::Tracker class tracks Image Targets and Multi Targets contained in a QCAR 1.5 Beta1 compatible target dataset. The ImageTracker class provides methods for creating, activating and deactivating datasets. All dataset operations shall be called only while the ImageTracker is not active. During the execution of the QCAR::UpdateCallback this is guaranteed. While multiple datasets can be loaded as explained in the DataSet class description, only one dataset can be active at any given time. Before using another dataset you must deactivate the currently active dataset, otherwise activateDatSet() returns FALSE. This also happens if the dataset to be activated was already active. NOTE: The methods for swapping the active dataset should not be called while the ImageTracker is working at the same time. Doing so will make these methods block and wait until the tracker has finished. The suggested way of swapping datasets is during the execution of UpdateCallback, which guarantees that the ImageTracker is not working concurrently. Alternatively the ImageTracker can be stopped explicitly. However, this is a very expensive operation.

Page 28 of 73

Relevant APIs The methods of the ImageTracker allow creating, active, deactivating, and destroying datasets. The getActiveDataSet() returns a pointer to the currently active dataset. virtual DataSet * virtual bool virtual bool virtual DataSet * virtual bool createDataSet ()=0 activateDataSet (DataSet *dataset)=0 deactivateDataSet (DataSet *dataset)=0 getActiveDataSet ()=0 destroyDataSet (DataSet *dataset)=0

2.2.1.4 QCAR::MarkerTracker Derived from the QCAR::Tracker class the MarkerTracker provides methods to create and destroy Frame Markers dynamically. NOTE: The methods for creating and destroying Frame Markers should not be called while the MarkerTracker is working at the same time as these methods block and wait until the MarkerTracker has finished. Therefore the suggested way of doing this is to perform create/delete operations during the execution of UpdateCallback, which guarantees that the MarkerTracker is not working concurrently. Alternatively the MarkerTracker can be explicitly stopped.

Relevant APIs Frame Markers can be created, destroyed or referenced using the methods listed below: virtual Marker * createFrameMarker (int markerId, const char *name, const QCAR::Vec2F &size)=0 destroyMarker (Marker *marker)=0 getNumMarkers () const =0 getMarker (int idx) const =0

virtual bool virtual int virtual Marker *

2.2.1.5 VideoBackgroundTexture In QCAR SDK 1.5 Beta1 you can now access the video background that is rendered by QCAR. The QCAR::Renderer provides methods to bind a shader to the rendering of the video background (refer to the modified Renderer API). The new VideoBackgroundTextureInfo struct provides information on the video background.

Page 29 of 73

2.2.2 Modified API


2.2.2.1 QCAR::Renderer The way how the QCAR SDK renders the video background has been altered starting with the QCAR SDK 1.5 Beta1 release. In QCAR 1.0 begin() already triggered the video background rendering, see following pseudo-code snippet:
renderFrame() { // Clear color and depth buffer glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Render video background: QCAR::State state = QCAR::Renderer::getInstance().begin(); // at this point video background is already rendered, // you can add your rendering on top of the video background ...

QCAR::Renderer::getInstance().end();

With the QCAR SDK 1.5 Beta1 release begin() locks only the State until end() is called, thus it is guaranteed that drawVideoBackground() between those calls will render the video background in sync with the pose data from the corresponding State. The difference is that drawVideoBackground()can be called now at any point between begin()and end(). Methods of the Renderer class must only be called from the render thread.
renderFrame() { // Clear color and depth buffer glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Get the state from QCAR and mark the beginning of a rendering section QCAR::State state = QCAR::Renderer::getInstance().begin(); // at this point NO video background is rendered, ... // explicitly render the Video Background QCAR::Renderer::getInstance().drawVideoBackground(); // now you can add rendering after the video background is rendered ...

QCAR::Renderer::getInstance().end();

This change allows, for example, rendering the video background multiple times with different transforms for multi-views in games, or rendering elements behind the video polygon. For more sophisticated effects or shaders applied to the video texture you would use the new function bindVideoBackground() method.

Page 30 of 73

Relevant APIs The new method added and described above is drawVideoBackground(), begin() and end()are only added for reference. virtual State virtual bool virtual void begin ()=0 drawVideoBackground ()=0 end ()=0

Full access to the video background rendering is given with the QCAR SDK 1.5 Beta1. virtual bool bindVideoBackground (int unit)=0

The new method bindVideoBackground()allows binding the video background texture to a texture unit and rendering it with your custom shader as shown in following pseudo-code snippet:
renderFrame() { // Get the state from QCAR and mark the beginning of a rendering section QCAR::State state = QCAR::Renderer::getInstance().begin(); QCAR::Renderer::getInstance().bindVideoBackground(0); // Load the shader and upload the vertex/texcoord/index data ... // To create vertex shader effects it is recommended // to refine the mesh of the video background polygon ... // Render the video background with the custom shader glUseProgram(vbShaderProgramID); ... // Call rendering glDrawElements(GL_TRIANGLES, vbNumIndices, GL_UNSIGNED_BYTE, vbOrthoQuadIndices); // Wrap up this rendering glUseProgram(0); // Render your AR overlay objects ... // It is always important to tell the QCAR Renderer // that we are finished QCAR::Renderer::getInstance().end();

Other methods changed in QCAR SDK 1.5 Beta1 in QCAR::Renderer : virtual bool setVideoBackgroundTextureID (int textureID)=0

Convenience method to configure the layout of the video background (location on the screen and size of polygon).

Page 31 of 73

virtual const VideoBackgroundTextureInfo &getVideoBackgroundTextureInfo ()=0 Returns the texture info associated with the current video background. The VideoBackgroundTextureInfo contains width and height of the video background texture in pixels and the format.

2.2.2.2 QCAR::Tracker Due to the introduction of the new trackers ImageTracker and MarkerTracker, the separate loading and handling of datasets, some methods of QCAR::Tracker have been moved in QCAR SDK 1.5 Beta1. The length of the identifier has been reduced from 64 to 25 for all trackables. The following methods have moved to QCAR::DataSet: virtual int virtual int virtual Trackable * load ()=0 getNumTrackables () const =0 getTrackable (int idx) const =0

The following methods have moved to QCAR::ImageTracker: virtual bool virtual void activate (unsigned int flags)=0 deactivate (unsigned int flags)=0

The following method hasmoved to QCAR::CameraDevice: virtual const CameraCalibration & getCameraCalibration () const =0 The following methods have moved to QCAR::State: virtual int virtual Trackable * getNumActiveTrackables () const =0 getActiveTrackable (int idx) const =0

Relevant APIs Starting and stopping the trackers is still performed with QCAR::Tracker: virtual bool virtual void start ()=0 stop ()=0

In addition a query method returning the type of tracker has been added: virtual TYPE getType ()=0

Page 32 of 73

2.2.2.3 QCAR::CameraDevice The read-only method to retrieve the camera calibration data has been moved from QCAR::Tracker to QCAR::CameraDevice: virtual const CameraCalibration & getCameraCalibration () const =0

2.2.2.4 QCAR::ImageTarget The ImageTarget class now has a method that allows changing the size (width and height) attribute of an ImageTarget in scene units. The dataset that this ImageTarget belongs to must not be active when calling this function or it will fail. Returns true if the size was set successfully, false otherwise. virtual bool setSize (const Vec2F &size)=0

2.2.2.5 QCAR::MultiTarget The create and destroy methods of MultiTarget are deprecated starting with QCAR SDK 1.5 Beta1. QCAR::Dataset provides the corresponding methods to create and destroy the Multi Target with the correct correspondence to the composing Image Targets in a specific DataSet. Following methods have been removed: static MultiTarget * create (const char *name) static bool destroy (MultiTarget *MultiTarget)

Page 33 of 73

2.3 Migrating your project from QCAR 1.0.6 to QCAR 1.5 Beta1
This section will give you a thorough description on how to upgrade your existing applications prepared with the QCAR SDK 1.0 to QCAR 1.5 Beta1. The samples provided with the QCAR SDK 1.5 Beta1 do have all these changes applied; instructions below are based on our samples and might vary in detail based on how you implemented your application.

2.3.1 AndroidManifest.xml
With the QCAR SDK 1.5 Beta1 we do not require OpenGL ES 2.0 if a device has only OpenGL 1.5 Beta1 support (Android 2.1), so you can safely comment out the following line:
<!-- <uses-feature android:glEsVersion="0x00020000" /> -->

The camera must be included specifically, otherwise devices with no camera would be able to install QCAR SDK based applications, which is of no value, so you must include the line:
<uses-feature android:name="android.hardware.camera" />

2.3.2 Android.mk
To conform the makefile to fit the slightly changed directory structure of the QCAR SDK 1.5 Beta1, make the following updates to your Android.mk file: LOCAL_SRC_FILES = ../../../build/lib/$(TARGET_ARCH_ABI)/libQCAR.so LOCAL_SRC_FILES = ../../../bin/Android/$(TARGET_ARCH_ABI)/libQCAR.so and LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/../../../build/include LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/../../../include

2.3.3 Eclipse Project Settings


NOTE: You will have to update QCAR_SDK_ROOT in your Eclipse project settings by setting its value in Window > Preferences > Java > Build Path > Classpath Variables to the new path of your QCAR SDK 1.5 Beta1 installation.

Page 34 of 73

2.3.4 config.xml and qcar-resources.dat

NOTE: QCAR SDK 1.5 Beta1 will not load datasets downloaded prior the publication of the Beta! You must log-in to the TMS, upload your images to create the targets and download your new target datasets. During the beta phase of QCAR SDK 1.5 Beta1 the functionality of the TMS remains unchanged to support QCAR SDK 1.0 developers. When you plan to use a downloaded dataset with the QCAR SDK 1.5 Beta1 you have to manually rename the files after opening the trackable assets package. Below you see the instructions, where the dataset name (also used in the load() function) is myDataset1: rename rename config.xml qcar-resources.dat myDataset1.xml and myDataset1.dat

2.3.5 Native Application C++ code (e.g. ImageTargets.cpp)


Based on the ImageTargets.cpp sample application we show what changes have to be applied to get it running using QCAR SDK 1.5 Beta1. In your specific case the instructions may vary based on how you implemented your code. 1. You must add new includes to support the new API:
#include <QCAR/TrackerManager.h> #include <QCAR/ImageTracker.h> #include <QCAR/DataSet.h>

2. Swappable Target Dataset Functions:Since there are new functions for the Tracker, you must add four new JNI exported functions (copy from ImageTargets.cpp): initTracker, deinitTracker, loadTrackerData, destroyTrackerData.
Be sure to edit those four functions to work with your named target datasets (since

you are now allowed many datasets at once), and be sure to edit the method signatures to match your project. 3. The renderFrame() method changes from one line to two. The code was:
QCAR::State state = QCAR::Renderer::getInstance().begin();

becomes

Page 35 of 73

QCAR::State state = QCAR::Renderer::getInstance().begin(); QCAR::Renderer::getInstance().drawVideoBackground();

4. Update the configureVideoBackground() method (see ImageTargets.cpp), as it now corrects the rendering background size to handle mismatch between screen and video aspect ratios. 5. The camera start method was:
// Start the tracker: QCAR::Tracker::getInstance().start(); // Cache the projection matrix: const QCAR::Tracker& tracker = QCAR::Tracker::getInstance(); const QCAR::CameraCalibration& cameraCalibration = tracker.getCameraCalibration();

becomes
// Start the tracker: QCAR::TrackerManager& trackerManager = QCAR::TrackerManager::getInstance(); QCAR::Tracker* imageTracker = trackerManager.getTracker( QCAR::Tracker::IMAGE_TRACKER); if(imageTracker != 0) imageTracker->start(); // Cache the projection matrix: const QCAR::CameraCalibration& cameraCalibration = QCAR::CameraDevice::getInstance().getCameraCalibration();

6. The camera stop used to be a single line:


QCAR::Tracker::getInstance().stop();

and now becomes a bit more complex:


QCAR::TrackerManager& trackerManager = QCAR::TrackerManager::getInstance(); QCAR::Tracker* imageTracker = trackerManager.getTracker( QCAR::Tracker::IMAGE_TRACKER); if (imageTracker != 0) imageTracker->stop();

2.3.6 Native Application Java code (e.g. ImageTargets.java)


Again, based on the ImageTargets.java sample application we show what changes have to be applied to get it running using QCAR SDK 1.5 Beta1. 1. You must add in several new application status constants:
// Application status constants: private static final int APPSTATUS_UNINITED private static final int APPSTATUS_INIT_APP private static final int APPSTATUS_INIT_QCAR = -1; = 0; = 1;

Page 36 of 73

private static final private static final private static final private static final private static final private static final

int int int int int int

APPSTATUS_INIT_TRACKER = 2; APPSTATUS_INIT_APP_AR = 3; APPSTATUS_LOAD_TRACKER = 4; APPSTATUS_INITED = 5; APPSTATUS_CAMERA_STOPPED = 6; APPSTATUS_CAMERA_RUNNING = 7;

Add in the new the splash screen member variables:


// The handler and runnable for the splash screen time out task. private Handler mSplashScreenHandler; private Runnable mSplashScreenRunnable;

There is also a new shutdown lock member variable that must be added:
// An object used for synchronizing QCAR initialization, dataset loading and // the Android onDestroy() life cycle event. If the application is destroyed // while a data set is still being loaded, then we wait for the loading // operation to finish before shutting down QCAR. private Object mShutdownLock = new Object();

2. To handle the new shutdown lock, you must update InitQCARTask (see ImageTargets.java) with the following changes: Use shutdown lock in doInBackground, Switch to APPSTATUS_INIT_TRACKER on success in onPostExecute, Remove INIT_CANNOT_DOWNLOAD_DEVICE_SETTINGS error message.

3. The function LoadTrackerTask needs to be updated to handle the shutdown lock. The changes need to look like this:
protected Boolean doInBackground(Void... params) { // Prevent the onDestroy() method to overlap: synchronized (mShutdownLock) { // Load the tracker data set: return (loadTrackerData() > 0); } }

4. Add declarations for the new tracker native methods:


/** Native tracker initialization and deinitialization. */ public native int initTracker(); public native void deinitTracker(); /** Native functions to load and destroy tracking data. */

Page 37 of 73

public native int loadTrackerData(); public native void destroyTrackerData();

5. Update the onPause method after stopping the camera, instead of before:
if (mAppStatus == APPSTATUS_CAMERA_RUNNING) { updateApplicationStatus(APPSTATUS_CAMERA_STOPPED); } // QCAR-specific pause operation QCAR.onPause();

6. Update onDestroy() method (see ImageTargets.java) so it performs the following tasks: dismisses splash screen timeout handler uses shutdown lock destroys tracker data deinitializes tracker

7. Update updateApplicationStatus() method (see ImageTargets.java) with the following: rename APPSTATUS_INIT_TRACKER case to APPSTATUS_LOAD_TRACKER add APPSTATUS_INIT_TRACKER case:
case APPSTATUS_INIT_TRACKER: // Initialize the ImageTracker if (initTracker() > 0) { // Proceed to next application initialization status updateApplicationStatus(APPSTATUS_INIT_APP_AR); } break;

APPSTATUS_INIT_APP_AR goes to APPSTATUS_LOAD_TRACKER instead of APPSTATUS_INIT_TRACKER splashScreenHandler is stored as a member variable.

Page 38 of 73

3 Unity Extension for Android

3.1 Getting Started


The QCAR Extension for Unity enables vision detection and tracking functionality into the Unity 3 IDE and allows developers to easily create AR applications and games. Developers need to first obtain Unity Android and/or Unity iOS from Unity Technologies in order to use the QCAR extension. The QCAR extension is compatible with both Unity Standard and Unity Pro. However, most developers will find that Unity Standard is sufficient for their needs. Please visit the Unity website http://www.unity3d.com for further information about Unity 3 and how to download it. Developers who have already installed Unity 3 can download the QCAR extension from the Downloads section at the top of this page. This section guides you through the easy steps of 1. Installing the Extension into your unity project, 2. Compiling a simple AR app, and 3. Mastering some of the more advanced AR topics.

3.1.1 Step 1: Installing the Extension


3.1.1.1 Download from this site Use the Android download page to get the package for your development platform and proceed to the installation instructions below. Please note that Unity 3.2, 3.3, or 3.4 is required for Android. Check the list of Android devices supported by the QCAR Extension for Unity. NOTE: Unity Android users should check the Unity documentation at http://unity3d.com/support/documentation/Manual/Android-Devices That Have Been Tested.html to make sure that our supported devices are also supported by Unity. Installation on Windows The recommended development environment for Android is Microsoft Windows 7 32/64bit or Windows XP. Please note that Unity 3.2, 3.3, or 3.4 is required. 1. Download installer EXE-file, from the download page. 2. Run installer 3. Select a location for the package installation convenient to your development environment. The extension-only package will also be copied to the Standard Packages folder of your Unity installation.

Page 39 of 73

NOTE: When using Unity on Win7 64 you may get the following message in the editor: Your 64 bit Windows installation is missing an important service pack patch. Please apply patch in http://support.microsoft.com/kb/976038 to ensure stability. NOTE: Should the extension-only package not be listed in your Unity Standard Assets list, copy the package manually to the Standard Packages folder of your Unity installation. Installation on Mac OS X Developer experience has been also successfully tested on Mac OS X 10.6. 1. Download archive file, from the QCAR download page. 2. Unarchive and run installer 3. Select a location for the sample package convenient to your development environment, Extension-only installation is defaulting to your Unity installation. Installation Result Five Unity packages should be installed: For Android: qcar-unity-android-xx-yy-zz-unitypackage: the base QCAR extension qcar-unity-imagetargets-android-xx-yy-zz.unitypackage: a sample project using Image Targets qcar-unity-framemarkers-android-xx-yy-zz.unitypackage: a sample project using Frame Markers qcar-unity-multitargets-android-xx-yy-zz.unitypackage: a sample project using Multi Targets qcar-unity-virtualbuttons-android-xx-yy-zz.unitypackage: a sample project using Virtual Buttons qcar-unity-videobackgroundaccess-android-xx-yy-zz.unitypackage: a sample project using video texture effects

Note that after installation of the QCAR unity package, there will be a new high-level menu item QCAR. This menu item provides easy access to documentation as well as target dataset naming and properties. 3.1.1.2 Download from the Unity AssetStore Alternatively, you can download the extension directly into your Unity project right from the Unity Asset Store. When in Unity 3, select Asset Store from the Window menu. Search for "Qualcomm Augmented Reality" and then download and import the desired package.

3.1.2 Step 2: Compiling a Simple Project


3.1.2.1 Create Project After you have installed the package, create a new project in Unity and select qcar-unityandroid-xx-yy-zz.unitypackage from the list of Import the following packages. Alternatively right-click in the Project view of an open project and choose Import Package Browse to the qcar-unity-android-xx-yy-zz.unitypackage you just installed and import it or double-clik on the downloaded package. When creating

Page 40 of 73

the Unity project avoid using spaces in the name because this will cause problems later. Note that by double-clicking on a package, you can selectively import parts of that package. NOTE: If you do not see the qcar unity package in the list, go back to Step 1 and manually install the packages. You will next need to add a target (or several targets) to your project. You can do this in two ways: by creating a target on the Target Management System (TMS) or by using existing targets from other projects. To use the TMS method, see DevGuide -> Target Management System online to create and download a package. Either double-click the downloaded package or right-click on Unity Project for Import Package, then Custom Package then select the downloaded package. Click on Import to import the target dataset. For 1.5Beta, you will receive an error that config.xml is ignored, no corresponding DAT file found. You will need to click on the QCAR menu, then Rename 1.0.x Data set, and choose and appropriate name for your target dataset, for this example, we will use ChipsBorder. If you are copying the dataset files from another project, be sure to also copy any files located in the Editor/QCAR/ImageTargetTextures folder. These will be used to texture the target plane in the Unity editor.

Page 41 of 73

You should now see the following folder structure inside Unity:

Here's a quick rundown of the folder contents: Editor Contains the scripts required to dynamically interact with Trackable data in the Unity editor. Plugins Contains Java and native binaries that integrate the QCAR SDK with the Unity Android application. Qualcomm Augmented Reality Contains the prefabs and scripts required to bring augmented reality to your Unity application. Streaming Assets Contains the swappable target datasets downloaded from the online Target Management System.

Page 42 of 73

3.1.2.2 Add AR Assets and Prefabs to Scene Now that you have imported the QCAR Unity Extension, you can easily adapt your project to use augmented reality. Expand the Qualcomm Augmented Reality folder, and then expand the Prefabs folder. Delete the Main Camera, and then drag an instance of the ARCamera prefab into your scene. The ARCamera is responsible for rendering the camera image in the background and manipulating scene objects to react to tracking data. With the ARCamera in place and the target assets available in the StreamingAssets/QCAR folder, you can run the application on a supported device and see the live video in the background.

Inspector view of the ARCamera

Page 43 of 73

Next, drag an instance of the ImageTarget prefab into your scene. This prefab represents a single Image Target Trackable object. Select the ImageTarget object in your scene, and look at the Inspector. There should be a Trackable Behaviour attached, with a property named Image Target. This property contains a drop-down list of all the available Image Targets for this project. You must select the Data Set and Image Target from your StreamingAssets/QCAR project. In this example, we choose StonesAndChips. (It is automatically populated from the config.xml file that is downloaded from the online Target Management System). The Unity sample apps come with several Image Targets that you can use. To use them copy them over from the ImageTargets sample or create your own at the My Trackables section of this site.

Inspector view of the ImageTarget

NOTE: When you added the Image Target object to your scene, a gray plane object appeared. This object is a placeholder for actual Image Targets. In the inspector view of the Image Target you will find a pop-up list called Image Target. From this list you can choose any Image Target that has been defined in one of the StreamingAssets/QCAR targets. After doing that the Image Target object in your scene adopts the size and shape from the Image Target it represents. It is also textured with the same image that the Image Target was created from.

Page 44 of 73

3.1.2.3 Add 3D Objects to Scene and Attach to Trackables Now you can bind 3D content to your Image Target. As a test, create a simple Cube object (GameObject > Create Other > Cube). Add the cube as a child of the ImageTarget object, by selecting it in the Hierarchy list and drag it onto the ImageTarget item. Move the cube in the scene until it is centered on the Image Target. You may also want to add a Directional Light to the scene to provide lighting (GameObject > Create Other > Directional Light). 3.1.2.4 TrackableEventHandler New to 1.5Beta, a default event handler (DefaultTrackableEventHandler) has been added to the Image Target. This default handler will cause the cube you just drew to automatically appear or disappear an automatic reaction to the appearance of the target in the video. You can override this default behavior if you want to one could also imagine playing a fade-out animation, showing an info screen or playing a sound for example. For a more detailed description of the ITrackableEventHandler interface please see 0 Responding to Tracking Events. 3.1.2.5 Adding Data Set Load to Camera Also new to 1.5Beta is the concept of multiple target datasets. You will need to tell Unity which dataset to load for your application. For this test, since we have borrowed from the ImageTarget app, we will load the StonesAndChips dataset, and make that the active dataset.

Page 45 of 73

3.1.2.6 Deploy Application The next step is to deploy your application to a supported device.

Android Deployment Process Unity provides a number of settings when building for Android devices you will need to select from the menu (File > Build Settings > Player Settings) to see the current settings. Also, choose your platform now Android. Click on Resolution and Presentation to ensure that Default Orientation is not set to Auto Rotation (can use portrait or Landscape Left). The QCAR extension does not support Auto Rotation. Click on Icon to set your application icon.

Page 46 of 73

Click on Other Settings. Set the Minimum API Level to Android 2.1 'Eclair' (API level 7)or higher. Set Bundle Identifier to a valid name (e.g. com.mycompany.firstARapp).

Next save your save (File > Save Scene). First, save your scene (File > Save Scene). Then open the build menu (File > Build Settings...). Make sure that your scene is part of Scenes in Build. If this is not the case either use Add Current to add the currently active scene or drag and drop your saved AR scene from the project view into the Window. You can now build the application. Attach your Android device and then click on Build And Run to initialize the deployment process.

The created AR scene

3.1.2.7 Using the Application You should have a printout of the appropriate Image Target in front of you. If you are working based off a Trackable in a sample app, the images are located at Editor/QCAR/ImageTargetTextures/<targetname>/*.jpg. Otherwise just print out the image that you uploaded to the Target Management System and make sure that the aspect ratio doesnt change. When you look at the target using the device camera, you should see your cube object bound to the target. Congratulations, you have successfully augmented reality! 3.1.2.8 Running in the Editor You can adjust the transform of the ARCamera object to get your entire scene in view, and then run the application in the Unity editor. There is no live camera image or tracking in the editor, instead all Trackables are assumed to be visible. This allows you to test the non-AR components of your application, such as scripts and animations, without having to deploy to the device each time.

Page 47 of 73

3.1.3 Mastering Advanced Topics


This section will guide you on how to create the various types of Trackables and Virtual Buttons supported by the QCAR SDK and how to use them in Unity. We have also included details on how to use some of the special options supported by the Extension. 3.1.3.1 Using Trackables Using Image Targets To create new target files, login to the online Target Management System: http://ar.qualcomm.at/qdevnet Create a new project, and create new Single Image Trackables by uploading your own images. Give each Trackable a unique name, these will show up in the drop-down AR Targets list in Unity. When you have created all of your Trackables, select the set you are interested in and choose download selected trackables. When prompted, be sure to select the Unity Editor format. A .unitypackage file will be downloaded to your computer. Double-click on this file to import it into the currently open Unity project. Alternatively, you can choose Assets > Import Package > Custom Package within Unity, and browse to the file. Be sure to accept all files in the package. All files will go in the Streaming Assets/QCAR folder, along with scaled versions of your images in the Editor/QCAR/ImageTargetTextures folder. Once you have imported the .unitypackage, the Unity project will automatically detect the new configuration file and update the available Image Targets accordingly. NOTE: for the 1.5Beta, you will need to rename the newly imported dataset using the QCAR menu, then Rename 1.0.x Data Set, and choose an appropriate name for the target dataset. NOTE: If there are existing files that you would overwrite with your import youll be queried if you really want to do that you may want to make a backup of your modified file before importing. NOTE: The Trackable sizes that are initially used in the target dataset might be scaled larger than a typical Unity object. You may want to scale down the Trackable in the inspector before using it in your scene. 3.1.3.2 Using Frame Markers The QCAR Unity Extension also supports Frame Markers. To add a Frame Marker to your scene, simply drag an instance of the FrameMarker prefab into your Scene or Hierarchy view. This prefab behaves similarly to the ImageTarget prefab, except that you specify a Frame Marker by ID rather than name. Make sure that each FrameMarker in your scene has a unique ID. As you drag out new instances of the FrameMarker prefab, they are automatically given the next highest marker ID. NOTE: You will find all Frame Markers as png files with the binary code in the Editor/QCAR/FrameMarkerTextures/frame_markers_transparent.zip

Page 48 of 73

package. To print them, scale the markers with nearest-neighbor option to a convenient size. NOTE: Frame markers are no longer placed in the target dataset file.

Using Multi Targets A Multi Target is a Trackable 3D object, made up of multiple Image Targets arranged in a known configuration (such as a box). You can use the online Target Management System (TMS) to create Multi Targets with simple shapes. You can also edit the config.xml file by hand, to create different configurations. Each "part" of a Multi Target is simply an Image Target that has a defined position and orientation relative to a common center. To change the scale, position or orientation of a part, you must use the TMS to edit the respective item or edit the target dataset file. Once you've added the target dataset file to Unity, you can drag an instance of the MultiTarget prefab into your scene. A gray cube appears. This is a placeholder object. Use the dropdown in the Inspector to choose a Multi Target by name. A new 3D object will replace the placeholder object, with the configuration defined in your target dataset file. Each plane of the Multi Target will be textured with its corresponding Image Target image. Please note that currently you cannot change the configuration of a Multi Target in the Unity editor. Do not change the transform of any of the ChildTargets. You can translate or rotate the target as a whole, but you cannot scale the target in the editor. If you need to scale the target, open the target xml file and scale the individual Image Targets. Multi Targets in Unity behave similarly to Image Targets. You can bind content to the target by adding it as a child. There is one added feature, however, and that is that the Multi Target automatically creates a set of depth masks to properly occlude other virtual objects. Please see the QCAR-MultiTargets sample project for a full example.

Page 49 of 73

Page 50 of 73

3.1.3.3 Using Virtual Buttons Creating Virtual Buttons in the Unity Editor Virtual buttons are "hotspots" on an Image Target that a user can touch in the real world to trigger an action. You add them by dragging an instance of the VirtualButton prefab onto an existing Image Target in the scene. You can then translate and scale the button to match the desired location, and give it a name. Virtual Buttons added this way are automatically written to the config.xml file. Note that a Virtual Button needs to be a child of the Image Target in the scene.

NOTE: Virtual Buttons only work with Image Targets, and not with Frame Markers or Multi Targets. Now that you have placed Virtual Buttons on the target, the next step is to handle events attributed to these buttons. You accomplish this by implementing the IVirtualButtonEventHandler interface. This interface has two methods, OnVirtualButtonPressed and OnVirtualButtonReleased. When the event handler is called, you will be passed an instance of the Virtual Button, including the name of the button. In this way you can respond to different button events. Please see the QCARVirtualButtons sample project for a full example. Creating and deleting Virtual Buttons at run-time You can create a new Virtual Button for a given Image Target at run-time by calling the CreateVirtualButton member function on the corresponding instance of your ImageTargetBehaviour. Note that both the position and size arguments are defined in the local Image Target space. You can in turn destroy a Virtual Button by calling DestroyVirtualButton, again defined in ImageTargetBehaviour.

Page 51 of 73

Note that with the introduction of swappable data sets, the data set must be deactivated before creating a virtual button:
Example code: // Deactivate the current data set ImageTracker imageTracker = (ImageTracker) TrackerManager.Instance.GetTracker(Tracker.Type.IMAGE_TRACKER); DataSet dataSet = imageTracker.GetActiveDataSet(); imageTracker.DeactivateDataSet(dataSet); // Create a virtual button ImageTargetBehaviour itb = GetComponent<ImageTargetBehaviour>(); VirtualButtonBehaviour vbb = itb.CreateVirtualButton("mybutton", new Vector2(0, 0), new Vector2(0.1f, 0.1f)); // Register an event handler // Here we assume this class extends IVirtualButtonEventHandler vbb.RegisterEventHandler(this); // Reactive the dataset imageTracker.ActivateDataSet(dataSet);

Reconfiguring Virtual Buttons at run-time It is possible to change the following attributes of a Virtual Button at run-time: Sensitivity Position on the Image Target Size of the area

You can set the sensitivity of a Virtual Button by setting the SensitivitySetting property in the VirtualButtonBehaviour instance. The position and the size of a Virtual Button can be changed by respectively changing the position and scale components in the transform of the Virtual Button game object. Tying Virtual Buttons to other game objects One typical use case for reconfiguring a Virtual Button at run-time is when you want a button to move along with another game object. To accommodate this, a Virtual Button does not need to be a direct child of the Image Target but can be attached to another game object which itself has an Image Target as a parent. When the game object moves, the Virtual Button will simply be moved along and the reconfiguration will be taken care of automatically. NOTE: This only works under predefined conditions that are enforced by editor scripts. The Virtual Button must be located at the center of its parent object. It is always axis aligned with the Image Target. Furthermore the parent cannot have a non-uniform scale. If it does the editor script automatically rescales the object and prints a warning.

Page 52 of 73

In the example below a Virtual Button is a child of the soccer ball:

Please see the QCAR-VirtualButtons sample for the full example.

3.1.3.4 Swappable Datasets The DataSetLoadBehaviour is a script that is by default attached to the ARCamera object. The script exposes a list of datasets (that are part of the project) to be loaded at scene startup. It also contains a drop down list to choose a dataset to be activated. You can use different settings in DataSetLoadBehaviour across different scenes. This enables you to implicitly bind datasets to Unity scenes. Please be aware that this script was not created to provide a runtime API. It only loads/activates the datasets at startup but doesnt do anything when its properties are changed later on in the application lifecycle. To change datasets at runtime a different interface has to be used. Runtime Dataset API Mainly three classes are used to load/unload and activate/deactivate datasets at runtime TrackerManager, ImageTracker and DataSet. Loading a dataset: Check if the file at the given storage location exists: DataSet.Exists(string path, DataSet.StorageType storageType); Note that you can also call Exists without specifying a storage type. The assumption then is that your dataset has been bundled with the application in StreamingAssets/QCAR.

Page 53 of 73

Request an ImageTracker instance from TrackerManager: TrackerManager.Instance.GetTracker(Tracker.Type.IMAGE_TRACKER); Create a new DataSet instance: ImageTracker.CreateDataSet(); Load a dataset file from its storage location: DataSet.Load(string path, DataSet.StorageType storageType); o The same storage type rules apply as for Exists.

Activating a dataset: Use the imageTracker instance to activate a dataset (remember that only a single dataset can be active at a time). ImageTracker.ActivateDataSet(DataSet dataset);

Example code:
// Load and activate a data set at the given path. private bool LoadDataSet(string dataSetPath, DataSet.StorageType storageType) { // Check if the data set exists at the given path. if (!DataSet.Exists(dataSetPath, storageType)) { Debug.LogError("Data set " + dataSetPath + " does not exist."); return false; } // Request an ImageTracker instance from the TrackerManager. ImageTracker imageTracker = (ImageTracker)TrackerManager.Instance.GetTracker(Tracker.Type.IMAGE_TRACKER); // Create a new empty data set. DataSet dataSet = imageTracker.CreateDataSet(); // Load the data set from the given path. if (!dataSet.Load(dataSetPath, storageType)) { Debug.LogError("Failed to load data set " + dataSetPath + "."); return false; } // (Optional) Activate the data set. imageTracker.ActivateDataSet(dataSet); return true; }

Adding content to a Trackable: Request a DataSetTrackableBehaviour instance from the dataset: DataSet.GetTrackable(int index); Attach a TrackableEventHandler to its game object: GameObject.AddComponent<MyTrackableEventHandler>(); You need to either write your own implementation of the ITrackableEventHandler interface or use the DefaultTrackableEventHandler that comes with the QCAR extension. The TrackableEventHandler provides callbacks to handle Trackable lost and found events. Add a child object for augmentation to the Trackable. GameObject.transform.parent = DataSetTrackableBehaviour.transform;

Page 54 of 73

Example Code:
// Add Trackable event handler and content (cubes) to the Trackables. private void AttachContentToTrackables(DataSet dataSet) { // Get the number of Trackables defined in the data set. int numTrackables = dataSet.GetNumTrackables(); // Loop over all Trackables. for (int i = 0; i < numTrackables; ++i) { DataSetTrackableBehaviour dstb = dataSet.GetTrackable(i); GameObject go = dstb.gameObject; // Add a Trackable event handler to the Trackable. // This Behaviour handles Trackable lost/found callbacks. go.AddComponent<DefaultTrackableEventHandler>(); // Create a cube object. GameObject cube = GameObject.CreatePrimitive(PrimitiveType.Cube); // Attach the cube to the Trackable and make sure it has a proper size. cube.transform.parent = dstb.transform; cube.transform.localScale = new Vector3(0.7f, 0.7f, 0.7f); cube.transform.localPosition = new Vector3(0.0f, 0.35f, 0.0f); cube.transform.localRotation = Quaternion.identity; cube.active = true; dstb.gameObject.active = true; } }

Destroying a data set: Request an ImageTracker instance as explained above. Make sure that the data set to destroy is not active (otherwise destruction will fail): ImageTracker.Deactivate(DataSet dataset); Destroy the data set: ImageTracker.DestroyDataSet(DataSet dataset, bool destroyTrackableGameObjects);

Example Code:
// Destroy a dataset. private bool DestroyDataSet(DataSet dataSet) { // Request an ImageTracker instance from the TrackerManager. ImageTracker imageTracker = (ImageTracker)TrackerManager.Instance.GetTracker(Tracker.Type.IMAGE_TRACKER); // Make sure the data set is not active. imageTracker.DeactivateDataSet(dataSet); // Destroy the data set // (choose true to also destroy the Trackable objects that belong to the data set). bool success = imageTracker.DestroyDataSet(dataSet, true); return success; }

Page 55 of 73

3.1.3.5 Special Options Responding to Tracking Events There are two interfaces you can implement to handle tracking events, the ITrackableEventHandler and the ITrackerEventHandler. The ITrackableEventHandler contains the OnTrackableStateChanged method, which is called each frame after the Trackable's data has been updated. Use this method to detect changes in the tracking state, such as whether the Trackable was just lost or just found. See the DefaultTrackableEventHandler for a reference implementation, located in the Assets/Qualcomm Augmented Reality/Scripts folder. We recommend copying the default event handler before modifying it, to avoid future upgrade conflicts. You can create a single class that implements the ITrackableEventHandler, and attach it to each of the Trackables in your scene. Or, you can create different implementations for different Trackables. Be sure to register your implementation with the TrackableBehaviour via the EventHandler field (see the samples for more details). NOTE: The relative orientation of all Trackables will be updated before the first OnTrackableStateChanged method is called. This means it is safe to do relative transform calculations in this callback. The ITrackerEventHandler contains the OnTrackablesUpdated method, which is called after each Trackable's ITrackableEventHandler has been called (once per frame). This might be a good place for game logic that depends on all Trackables being updated and stable. Initialization Error Handling It is important for your application to detect and handle all of the possible QCAR initialization errors. These include cases where the device is not supported or device settings cannot be downloaded. Each of the sample applications comes with a DefaultInitializationErrorHandler attached to the ARCamera object. Use the sample implementation as a starting point for creating your own error handler. Enabling and Disabling AR Objects Enabling and disabling the various QCAR Behaviours works as expected in Unity. Disabling the TrackerBehaviour will stop the tracker and the camera, freeing up CPU cycles for menus or other non-AR application behavior. Disabling Trackables or VirtualButtons will prevent these objects from receiving updates from the tracker, and re-enabling them will restore these updates. AR Camera Object Options The following options are available on the ARCamera object: Camera Device Mode Setting: Select between default, fast, and high-quality camera modes. Max Simultaneous Image Targets: Set the number of Image Targets the tracker should try to track simultaneously. Multi Frame Enabled: Set to split the detection of untracked Image Targets over multiple frames.

Page 56 of 73

Synchronous Video: Set to synchronize rendering updates with camera updates. Not recommended for scenes with animated content. World Center Mode: o If set to USER, you can set up a single Trackable as the world center. This Trackable will never move in the scene, instead the camera and all other Trackables will move in relation to it, as long as it is visible. o If set to AUTO, the first visible Trackable is selected to be the world center. o If set to NONE, the camera is fixed in place and all Trackables move in relation to it.

Image Target Object Options The following options are available on the Image Target object: Data Set: A drop-down list of available data sets, defined by the sets located in the StreamAssets\QCAR folder. Image Target: A drop-down list of available Image Targets, defined in the data set xml file in the StreamingAssets\QCAR folder. Preserve child size: If checked, any children of this target maintain their size when the target is changed. If unchecked, the child objects will resize to match the new target scale.

Virtual Button Options The following options are available on the Virtual Button object: Name: The name of the Virtual Button, used to uniquely identify the button when handling events. Sensitivity Setting: The sensitivity of press detection. HIGH for fast detection, LOW for robust detection.

Camera Flash and Auto Focus The CameraDeviceBehaviour provides access to two camera features, the flash and auto focus. You can turn the flash LED on with the SetFlashTorchMode method. You can also start and stop auto focus, and choose a focus mode that works with your tracking needs. See the ImageTargets sample project for a sample script that tests these various modes, Scripts/CameraDeviceMenu.cs. Camera Image The CameraDeviceBehaviour also provides access to the per-frame camera image. This can be useful for image processing, render effects, and screenshots. You can register for various image formats (e.g. RGB565, grayscale) using the SetFrameFormat method. Then you can get the camera image for the current frame with the GetCameraImage method. The image is returned as a byte array with the necessary size information. Video Background Access Video background access allows you to use the camera video as a texture. Of course this also means that you can now modify the video with your own custom shaders.

Page 57 of 73

Follow these main steps to use the video background as a texture: On start turn-off automatic video background rendering: QCARRenderer.Instance.DrawVideoBackground = false Get the native texture ID from your Unity texture object: int nativeTextureID = myTexture.GetNativeTextureID() Pass the texture ID over to QCAR: QCARRenderer.Instance.SetVideoBackgroundTextureID(nativeTextureID) In the update callback wait until the camera is active. That is the case once a video background info is available: QCARRenderer.Instance.IsVideoBackgroundInfoAvailable() Request information about the video texture from QCAR and change your update your game objects accordingly (e.g. update UVs): QCARRenderer.VideoTextureInfo texInfo = QCARRenderer.Instance.GetVideoTextu reInfo()

The QCAR-VideoBackgroundAccess sample fills you in on the details. You can use the Scripts->VideoTextureBehaviour.cs script as a starting point.

Page 58 of 73

3.2 Unity SDK API Changes

3.2.1 Default Handlers


In version 1.0 of the QCAR extension it was necessary to implement certain interfaces to achieve some default behavior. The interfaces were ITrackableEventHandler and IQCARErrorHandler. ITrackableEventHandler is used to make augmentations appear and disappear. If not implemented, the behavior was that 3D objects just stayed on screen whenever the Trackable was lost. The IQCARErrorHandler was responsible to catch errors such as unsupported device error. To speed up development of applications which only need minimal functionality we have introduced default implementations of the given interfaces (ITrackableEventHandler and IQCARErrorHandler). These default implementations are attached to the Trackable prefab (DefaultTrackableEventHandler) and the ARCamera prefab (DefaultInitializationErrorHandler) that come with the extension package. To implement your own advanced behavior just replace the Default scripts with your own implementations. Also note that the IQCARErrorHandler interface has been removed. Querying error codes is now done by calling QCAR.CheckInitializationError() at application startup.

3.2.2 Datasets
The main change in QCAR SDK 1.5 Beta1 is the support for multiple datasets in a single application. You can now load and unload datasets whenever you want. Multiple datasets can be loaded at the same time but only a single dataset can be active at a time. 3.2.2.1 Dataset Import In version 1.0 of the QCAR Unity extension there was only support for a single dataset file (called config.xml). This file was automatically read when put into the StreamingAssets/QCAR folder and its values were automatically applied to objects in the scene. Likewise, changes in the Unity scene were automatically written back to the file whenever they were applied. With 1.5, the mechanism has become less automatic to allow for multiple datasets. What has changed for the dataset import: Datasets are checked for correct naming: This means that there need to be a .DAT and an accompanying .XML file which use the same name. Different datasets shall have different names. The 1.0 dataset structure is not supported anymore. o Datasets need to be completely recreated: Log into TMS, create a new project, upload your images to create new trackables and download the new trackables from the TMS. o Inside Unity the datasets need to be renamed using QCAR->Rename 1.0.x Data Set from the Unity menu bar (this will not be necessary anymore after the commercial release). The actual import of Trackable data has slightly changed (mostly behind the scenes).

Page 59 of 73

o o

Markers are not read from the data set file anymore. Instead they are created automatically at initialization time. The following Trackable properties are still imported automatically. The textures will be updated on the fly. The aspect ratio of Image Targets will be updated on the fly. The longer side of the new trackable will be kept (see examples). All Multi Target properties will be imported. To make the process more secure, we do not import the following properties without user intervention anymore: The size of Image Targets will NOT be updated automatically. Virtual Buttons will NOT be created automatically. Instead these values (size of Image Targets and creation of VirtualButtons) are now only applied if the user explicitly calls: QCAR-> Apply Data Set Properties from the menu bar. Any Trackable properties modified in the editor will not be written back into the dataset.xml file. The properties are now all applied at application initialization. Examples for the automatic aspect ratio update on import: Old Trackable in scene: width = 200, height = 100; New Trackable from dataset: width = 400, height = 100; the width of the new Trackable is longer than its height. This means that the old width will be KEPT. The values after updating the aspect ratio are therefore: Width = 200, height = width * (imported height/imported width) = 200 * (100/400) = 200 * 1/4 = 50. Old Trackable in scene: width = 200, height = 100; New Trackable from dataset: width = 50, height = 200; the height of the new Trackable is longer than its width. => Height = 100 will be kept. The updated values are: Width = height * (imported width/imported height) = 100 * (50/200) = 100 * 1/4 = 25, height = 100.

Reasons for the change Now it is possible in QCAR to change all Trackable properties (except for names) at runtime. This means that we dont need to rely on the datasetsXML file to contain our changes. Instead we just set them at initialization time. Synchronizing the scene and the datasets XML file is not very secure. There are many ways to mess up the file (on purpose or not). By making file import a (semi-) manual process we have reduced possible errors. Supporting multiple datasets in a single project makes it harder to keep an overview. Again, doing everything automatically can cause unwanted behavior.

3.2.2.2 Dataset Usage There are two ways to use datasets now. You can use the ARCamera objects new DataSetLoadBehaviour script or the QCAR extension API to load and activate datasets.

Page 60 of 73

DataSetLoadBehaviour The DataSetLoadBehaviour is a script that is by default attached to the ARCamera object. The script exposes a list of datasets (that are part of the project) to be loaded at scene startup. It also contains a drop down list to choose a dataset to be activated. You can use different settings in DataSetLoadBehaviour across different scenes. This enables you to implicitly bind datasets to Unity scenes. Please be aware that this script was not created to provide a runtime API. It only loads/activates the datasets at startup but doesnt do anything when its properties are changed later on in the application lifecycle. To change datasets at runtime a different interface has to be used (see next section). Runtime dataset API There are three classes are used to load/unload and activate/deactivate datasets at runtime TrackerManager, ImageTracker and DataSet.

Loading a dataset Make sure the file exists: DataSet.Exists(string path, DataSet.StorageType storageType); o Note that you can also call Exists without specifying a storage type. The assumption then is that your dataset has been bundled with the application in StreamingAssets/QCAR. Request an ImageTracker instance from TrackerManager: TrackerManager.Instance.GetTracker(Tracker.Type.IMAGE_TRACKER) ; Create a new DataSet instance: ImageTracker.CreateDataSet(); Load a dataset file from its storage location: DataSet.Load(string path, DataSet.StorageType storageType); o The same storage type rules apply as for Exists.

Activating a dataset Once the dataset has been loaded, use imageTracker.ActivateDataSet(DataSet dataset) to activate a dataset (remember that only a single dataset can be active at any time). The code below illustrates how to do this.
// Load and activate a data set at the given path. private bool LoadDataSet(string dataSetPath, DataSet.StorageType storageType) { // Check if the data set exists at the given path. if (!DataSet.Exists(dataSetPath, storageType)) { Debug.LogError("Data set " + dataSetPath + " does not exist."); return false; } // Request an ImageTracker instance from the TrackerManager. ImageTracker imageTracker = (ImageTracker)TrackerManager.Instance.GetTracker(Tracker.Type.IMAGE_TRACKER);

Page 61 of 73

// Create a new empty data set. DataSet dataSet = imageTracker.CreateDataSet(); // Load the data set from the given path. if (!dataSet.Load(dataSetPath, storageType)) { Debug.LogError("Failed to load data set " + dataSetPath + "."); return false; } // (Optional) Activate the data set. imageTracker.ActivateDataSet(dataSet); return true; }

Adding content to a Trackable: Request a DataSetTrackableBehaviour instance from the dataset: DataSet.GetTrackable(int index); Attach a TrackableEventHandler to its game object: GameObject.AddComponent<MyTrackableEventHandler>(); You need to either write your own implementation of the ITrackableEventHandler interface or use the DefaultTrackableEventHandler that comes with the QCAR extension. The TrackableEventHandler provides callbacks to handle Trackable lost and found events. Add a child object for augmentation to the Trackable. GameObject.transform.parent = DataSetTrackableBehaviour.transform;

// Add Trackable event handler and content (cubes) to the Trackables. private void AttachContentToTrackables(DataSet dataSet) { // Get the number of Trackables defined in the data set. int numTrackables = dataSet.GetNumTrackables(); // Loop over all Trackables. for (int i = 0; i < numTrackables; ++i) { DataSetTrackableBehaviour dstb = dataSet.GetTrackable(i); GameObject go = dstb.gameObject; // Add a Trackable event handler to the Trackable. // This Behaviour handles Trackable lost/found callbacks. go.AddComponent<DefaultTrackableEventHandler>(); // Create a cube object. GameObject cube = GameObject.CreatePrimitive(PrimitiveType.Cube); // Attach the cube to the Trackable and make sure it has a proper size. cube.transform.parent = dstb.transform; cube.transform.localScale = new Vector3(0.7f, 0.7f, 0.7f); cube.transform.localPosition = new Vector3(0.0f, 0.35f, 0.0f); cube.transform.localRotation = Quaternion.identity; cube.active = true; dstb.gameObject.active = true; } }

Page 62 of 73

Destroying a data set Request an ImageTracker instance as explained above. Make sure that the data set to destroy is not active (otherwise destruction will fail): ImageTracker.Deactivate(DataSet dataset); Destroy the data set: ImageTracker.DestroyDataSet(DataSet dataset, bool destroyTrackableGameObjects);

// Destroy a dataset. private bool DestroyDataSet(DataSet dataSet) { // Request an ImageTracker instance from the TrackerManager. ImageTracker imageTracker = (ImageTracker)TrackerManager.Instance.GetTracker(Tracker.Type.IMAGE_TRACKER); // Make sure the data set is not active. imageTracker.DeactivateDataSet(dataSet); // Destroy the data set // (choose true to also destroy the Trackable objects that belong to the data set). bool success = imageTracker.DestroyDataSet(dataSet, true); return success; }

3.2.2.3 Markers Marker usage has also changed in Unity 1.5 Beta1. They cannot be placed in datasets XML files anymore. Instead you have to either create them in the Unity IDE. Creating them in the IDE works the same as before. Just drag and drop a FrameMarker prefab from the Qualcomm Augmented Reality->Prefabs folder into the scene.

3.2.2.4 Video Background Access Video background access allows you to use the camera video as a texture. Of course this also means that you can now modify the video with your own custom shaders. Follow these main steps to use the video background as a texture: On start, turn off automatic video background rendering: QCARRenderer.Instance.DrawVideoBackground = false Get the native texture ID from your Unity texture object: int nativeTextureID = myTexture.GetNativeTextureID() Pass the texture ID over to QCAR: QCARRenderer.Instance.SetVideoBackgroundTextureID(nativeTextur eID) In the update callback wait until the camera is active (that is the case once a video background info is available): QCARRenderer.Instance.IsVideoBackgroundInfoAvailable() Request information about the video texture from QCAR and change your update your game objects accordingly (e.g. update UVs):

Page 63 of 73

QCARRenderer.VideoTextureInfo texInfo = QCARRenderer.Instance.GetVideoTextureInfo() The VideoBackgroundAccess sample fills you in on the details. You can use the Scripts->VideoTextureBehaviour.cs script as a starting point.

Page 64 of 73

3.3 Upgrading a QCAR 1.0.6 Unity Project to QCAR 1.5


1. Make a backup of your existing Unity project (don't skip this step!) 2. From the Unity Project view, delete the following folders: Editor/QCAR/Scripts Qualcomm Augmented Reality/Scripts 3. From the Unity Project view, delete the following files: Plugins/Android/libQCAR Plugins/Android/libQCARUnityPlayer Plugins/Android/libQCARWrapper 4. From the Unity Project view, delete the following files if they exist. You may have modified these files, if so make a copy. Scripts/CameraDeviceMenu Scripts/InitializationErrorHandler Scripts/TrackableEventHandler Scripts/TrackerEventHandler 5. Import qcar-unity-android-1-5-0.unitypackage 6. Fix any errors (open the Console to view errors). Note the following changes: CameraDeviceBehaviour is now the CameraDevice singleton. You can access it with CameraDevice.Instance. IQCARErrorHandler no longer exists. See DefaultInitializationErrorHandler for new usage. TrackerBehaviour is now QCARBehaviour 7. Log into the TMS, upload your images to create new trackables and download your new trackables from the TMS (https://ar.qualcomm.at/qdevnet/projects) and import into Unity. You cannot use the trackables created prior to QCAR 1.5 Beta1. 8. In Unity, choose "Rename 1.0.x Data Set" from the QCAR Menu. Give the data set a name and click OK (you may need to expand the window to see the button). NOTE: If the QCAR Menu item hasn't shown up yet, try saving your scene. You may need to restart Unity at this point. 9. Fix the ARCamera: If you haven't made any changes to the ARCamera, it might be easiest to delete the existing object and add the prefab again. Otherwise, here are the upgrade steps: a. Set the first Missing (Mono Script) to QCARBehaviour. This should be the one with Inspector options (e.g. Camera Device Mode Setting). b. Remove all the other components with a Missing (Mono Script). c. Add the following scripts to the ARCamera (if they are missing):

Page 65 of 73

Qualcomm Augmented Reality/Scripts/DataSetLoadBehaviour Qualcomm Augmented Reality/Scripts/DefaultInitializationErrorHandler

10. Set the Activate Data Set of the Data Set Load Behaviour component. Also check the box next to Load Data Set. 11. For each of your ImageTargets, select the Data Set and Image Target in the Inspector. 12. For each of your MultiTargets, select the Data Set and Multi Target in the Inspector. 13. For each of your trackables, add a TrackableEventHandler. You can either copy your old handler back into the project, or use the new default handler: Qualcomm Augmented Reality/Scripts/DefaultTrackableEventHandler NOTE: We recommend that you copy the default handler before making changes to it, to avoid future upgrade issues. NOTE: The trackable might have a Missing (Mono Script) for the old handler, you can remove this. 14. If your project uses a TrackerEventHandler (and you removed it in Step 4) add it back in, and fix the errors. You can get a working sample from the ImageTargets project. 15. If your project uses a CameraDeviceMenu (and you removed it in Step 4) add it back in, and fix the errors. You can get a working sample from the ImageTargets project. 16. If your project uses a custom InitializationErrorHandler (and you removed it in Step 4) add it back in, and fix the errors. You can compare to the new DefaultInitializationHandler.

Page 66 of 73

4 DevGuide changes 4.1 Swap Dataset at Runtime


4.1.1 Config.xml Definitions
For the QCAR SDK 1.0, Image Targets were defined in the config.xml. For the QCAR SDK 1.5 Beta1, the Image Targets are defined in developer-named datasets, such as "tarmac.xml" or "stonesandchips.xml". The example below shows two Image Targets "stones" and "chips" used in one target resource database. This is exactly how the Image Targets sample app is set up. Size is defined in millimeters, with respect to the actual printed targets:
<?xml version="1.0" encoding="UTF-8"?> <QCARConfig xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="qcar_config.xsd"> <Tracking> <ImageTarget size="247 173" name="stones" /> <ImageTarget size="247 173" name="chips" /> </Tracking> </QCARConfig>

NOTE: The corresponding resource file must be named also "tarmac.xml" or "stonesandchips.xml" in the above examples.

4.1.2 Active Trackable Code Fragment


Image Targets are accessed through a list of active trackables. In the example below the code iterates through the active trackables of a state object, gets the pose information of the active Image Target and then modifies the texture based on the target name. The actual rendering is not shown:
// Did we find any trackables this frame? for(int tIdx = 0; tIdx < state.getNumActiveTrackables(); tIdx++) { // Get the trackeable: const QCAR::Trackable* trackable = state.getActiveTrackable(tIdx); QCAR::Matrix44F modelViewMatrix = QCAR::Tool::convertPose2GLMatrix(trackable>getPose()); // Choose the texture based on the target name: int textureIndex = (!strcmp(trackable->getName(), "stones")) ? 0 : 1; const Texture* const thisTexture = textures[textureIndex]; // ... render actual geometry // ...

Page 67 of 73

4.1.3 Loading Dataset Code Fragment


Image Targets can use multiple datasets, so you are no longer limited to 50 Targets. In the example below, the application will create and load set up for two datasets, and then activate one of the datasets (from the ImageTargets example).
// Get the image tracker: QCAR::TrackerManager& trackerManager = QCAR::TrackerManager::getInstance(); QCAR::ImageTracker* imageTracker = static_cast<QCAR::ImageTracker*> (trackerManager.getTracker(QCAR::Tracker::IMAGE_TRACKER)); if (imageTracker == NULL) { LOG("Failed to load tracking data set because the ImageTracker has" " not been initialized."); return 0; } // Create the data sets: dataSetStonesAndChips = imageTracker->createDataSet(); if (dataSetStonesAndChips == 0) { LOG("Failed to create a new tracking data."); return 0; } dataSetTarmac = imageTracker->createDataSet(); if (dataSetTarmac == 0) { LOG("Failed to create a new tracking data."); return 0; } // Load the data sets: if (!dataSetStonesAndChips->load("StonesAndChips.xml", QCAR::DataSet::STORAGE_APPRESOURCE)) { LOG("Failed to load data set."); return 0; } if (!dataSetTarmac->load("Tarmac.xml", QCAR::DataSet::STORAGE_APPRESOURCE)) { LOG("Failed to load data set."); return 0; } // Activate the data set: if (!imageTracker->activateDataSet(dataSetStonesAndChips)) { LOG("Failed to activate data set."); return 0; }

Page 68 of 73

4.2 Frame Markers


4.2.1 Definition
In addition to feature based detection and tracking, the QCAR SDK can track a special type of fiducial marker called "Frame Markers". The unique id of a Frame Marker is encoded into a binary pattern along the border of the marker image. A Frame Marker allows any image to be placed within the marker borders. They are more desirable as they look more natural than other more traditional fiducial markers. The QCAR SDK requires the frame and the binary pattern to be entirely visible in the camera image for recognition. Unlike Image Targets, Frame Markers are not generated by the on-line Target Management System. All 512 Frame Markers are distributed as an archive within the assets\ folder of the QCAR SDK installation. To scale them to the appropriate printable size, use the scale operation with the "no filtering" or nearest neighbor option in any image editor (such as Adobe Photoshop). Starting QCARSDK 1.5 Beta1 markers can only be instantiated at run-time, they are not read from the config.xml. See the relevant APIs below. Due to the relatively low processing power required to decode the marker ID, all 512 Frame Markers can be used in an application and about five can be detected and tracked simultaneously. NOTE: The width of the Frame Markers border changed. Make sure to use the updated Frame Marker templates located in the assets\ folder.

4.2.2 Creation in QCAR SDK 1.5 Beta1 and Code Fragment


For QCAR SDK 1.5 Beta1, Frame Markers are defined in the native code only. The code fragment below (from the FrameMarkers sample code) illustrates the creation of four Frame Markers.
// Initialize the marker tracker: QCAR::TrackerManager& trackerManager = QCAR::TrackerManager::getInstance(); QCAR::Tracker* trackerBase = trackerManager.initTracker(QCAR::Tracker::MARKER_TRACKER); QCAR::MarkerTracker* markerTracker = static_cast<QCAR::MarkerTracker*>(trackerBase); if (markerTracker == NULL) { LOG("Failed to initialize MarkerTracker."); return 0; } LOG("Successfully initialized MarkerTracker."); // Create frame markers: if (!markerTracker->createFrameMarker(0, "MarkerQ", QCAR::Vec2F(50,50)) || !markerTracker->createFrameMarker(1, "MarkerC", QCAR::Vec2F(50,50)) || !markerTracker->createFrameMarker(2, "MarkerA", QCAR::Vec2F(50,50)) || !markerTracker->createFrameMarker(3, "MarkerR", QCAR::Vec2F(50,50))) { LOG("Failed to create frame markers."); return 0; } LOG("Successfully created frame markers.");

Page 69 of 73

4.3 Samples
4.3.1 Overview
For the QCAR SDK 1.5 Beta1 release we have changed the ImageTargets sample and added the BackgroundTextureAccess sample: Image Targets ImageTargets shows how to detect an image trackable and render a simple object on it. The sample code also shows how to enable simultaneous detection and tracking of multiple targets as well as how to create, load and activate multiple image datasets.The sample code also shows how to manage different aspects of the camera, such as flash and autofocus. BackgroundTextureAccess Similar to the ImageTarget sample application, the BackgroundTextureAccess application illustrates how to use two shaders to manipulate the video. One shader turns the video into inverted black-and-white, and another distorts the video around where you touch on the screen.

4.3.2 ImageTargets

ImageTarget sample 4.3.2.1 ImageTargets Usage: Print the tarmac, stones and the chips PDF targets from the samples \media folder, maintain correct aspect ratio when printing. Build and deploy the application as detailed in the Getting Started guide. Point your camera at the printed Image Target to see the augmented teapot object. The apps menu allows you to turn the flash on the phone ON/OFF, and to select a focus mode. You can trigger the auto focus mode by tapping the menu button in the middle.

Page 70 of 73

You can switch between the two datasets (tarmac or stonesandchips) by tapping the menu button and then tapping the toggle dataset button. In addition, the apps menu allows you to turn the flash on the phone ON/OFF, and to select a focus mode. You can trigger the auto focus mode by tapping the middle menu button .

4.3.2.2 Sample Specific Notes The SDK includes input images for the ImageTargets sample app. You can use these images, located in the samples\media folder to start testing the target creation process before you upload your own artwork. To be able to directly add the downloaded assets from the Target Management System use name "chips" with the chips.jpg file (name ="stones" for the stones.jpg, and "tarmac" for the tarmac.jpg). To regenerate the original ImageTarget sample trackables choose width = 247 and height = 173. Other sizes will also work, but the augmented object will scale in the 3D scene accordingly to the relation of the originally used scale. Note that you will need to create two trackables "stonesandchips" (containing the "chips" and "stones" images) and "tarmac" (containing the "tarmac" image).

4.3.3 BackgroundTextureAccess

BackgroundTextureAccess sample 4.3.3.1 Usage Print the tarmac PDF targets from the samples \media folder, maintain correct aspect ratio when printing. Build and deploy the application as detailed in the Getting Started guide. Point your camera at the printed Image Target to see the augmented teapot object.

Page 71 of 73

The apps menu allows you to turn the flash on the phone ON/OFF, and to select a focus mode. You can trigger the auto focus mode by tapping the menu button in the middle. In addition, the apps menu allows you to turn the flash on the phone ON/OFF, and to select a focus mode. You can trigger the auto focus mode by tapping the menu button in the middle.

4.3.3.2 Sample Specific Notes The SDK includes input images for the ImageTargets sample app. You can use these images, located in the samples \media folder to start testing the target creation process before you upload your own artwork. To be able to directly add the downloaded assets from the Target Management System use name "tarmac" with the tarmac.jpg file. To regenerate the original ImageTarget sample trackables choose width = 247 and height = 173. Other sizes will also work, but the augmented object will scale in the 3D scene accordingly to the relation of the originally used scale. You will need to create a single trackable tarmac (containing the tarmac image). This app uses two shaders the vertex shader and the fragment shader. The vertex shader turns the video into grayscale, and then inverts the black and white. The fragment shader will listen for a touch on the screen ad then distort the video around that touch.

Page 72 of 73

5 Appendix QCAR Public API documentation


Follow the full publicAPI documentation starting next page. NOTE: Page numbers in the publicAPI documentation are with reference to Appendix.

Page 73 of 73

QCAR SDK v1.5 Beta1 Public API Documentation for Android only

Offline version of https://ar.qualcomm.at/qdevnet/api

QCAR SDK v1.5 Beta1 Public API Documentation

Appendix Table of Contents


API Introduction ...................................................................................................................................... iv Namespace Index ................................................................................................................................... v Class Index............................................................................................................................................. vi Class Index.............................................................................................................................................vii File Index ............................................................................................................................................... viii Namespace Documentation .................................................................................................................... 9 QCAR Namespace Reference .......................................................................................................... 10 QCAR::Tool Namespace Reference ................................................................................................. 15 Class Documentation ............................................................................................................................ 17 QCAR::CameraCalibration Class Reference .................................................................................... 19 QCAR::CameraDevice Class Reference ........................................................................................... 21 QCAR::DataSet Class Reference ..................................................................................................... 25 QCAR::Frame Class Reference ........................................................................................................ 28 QCAR::Image Class Reference ........................................................................................................ 30 QCAR::ImageTarget Class Reference .............................................................................................. 32 QCAR::ImageTracker Class Reference ............................................................................................ 35 QCAR::Marker Class Reference ....................................................................................................... 37 QCAR::MarkerTracker Class Reference ........................................................................................... 39 QCAR::Matrix34F Struct Reference .................................................................................................. 41 QCAR::Matrix44F Struct Reference .................................................................................................. 42 QCAR::MultiTarget Class Reference ................................................................................................ 43 QCAR::NonCopyable Class Reference ............................................................................................. 46 com.qualcomm.QCAR.QCAR Class Reference................................................................................ 48 QCAR::Rectangle Class Reference .................................................................................................. 50 QCAR::Renderer Class Reference ................................................................................................... 52 QCAR::State Class Reference .......................................................................................................... 54 QCAR::Trackable Class Reference ................................................................................................... 56 QCAR::Tracker Class Reference ...................................................................................................... 59 QCAR::TrackerManager Class Reference ........................................................................................ 61 QCAR::UpdateCallback Class Reference ......................................................................................... 63 QCAR::Vec2F Struct Reference ........................................................................................................ 64 QCAR::Vec2I Struct Reference ......................................................................................................... 65 QCAR::Vec3F Struct Reference ........................................................................................................ 66 QCAR::Vec3I Struct Reference ......................................................................................................... 67 QCAR::Vec4F Struct Reference ........................................................................................................ 68 QCAR::Vec4I Struct Reference ......................................................................................................... 69 QCAR::VideoBackgroundConfig Struct Reference ........................................................................... 70 QCAR::VideoBackgroundTextureInfo Struct Reference ................................................................... 71 QCAR::VideoMode Struct Reference ................................................................................................ 72 QCAR::VirtualButton Class Reference .............................................................................................. 73 File Documentation ............................................................................................................................... 75 CameraCalibration.h File Reference ................................................................................................. 76 CameraDevice.h File Reference ....................................................................................................... 77 DataSet.h File Reference .................................................................................................................. 78 Frame.h File Reference ..................................................................................................................... 79 Image.h File Reference ..................................................................................................................... 80 ImageTarget.h File Reference ........................................................................................................... 81 ImageTracker.h File Reference ......................................................................................................... 82 Marker.h File Reference .................................................................................................................... 83 MarkerTracker.h File Reference ........................................................................................................ 84 Matrices.h File Reference.................................................................................................................. 85 MultiTarget.h File Reference ............................................................................................................. 86 NonCopyable.h File Reference ......................................................................................................... 87 QCAR.h File Reference ..................................................................................................................... 88 QCAR.java File Reference ................................................................................................................ 90 Rectangle.h File Reference ............................................................................................................... 91 Renderer.h File Reference ................................................................................................................ 92

Appendix - ii

QCAR SDK v1.5 Beta1 Public API Documentation

State.h File Reference ....................................................................................................................... 93 System.h File Reference ................................................................................................................... 94 Tool.h File Reference ........................................................................................................................ 95 Trackable.h File Reference ............................................................................................................... 96 Tracker.h File Reference ................................................................................................................... 97 TrackerManager.h File Reference ..................................................................................................... 98 UpdateCallback.h File Reference ...................................................................................................... 99 Vectors.h File Reference ................................................................................................................. 100 VideoBackgroundConfig.h File Reference ...................................................................................... 101 VideoBackgroundTextureInfo.h File Reference .............................................................................. 102 VideoMode.h File Reference ........................................................................................................... 103 VirtualButton.h File Reference......................................................................................................... 104 Index.................................................................................................................................................... 105

NOTE: Page numbers are with reference to Appendix.

Appendix - iii

QCAR SDK v1.5 Beta1 Public API Documentation

API Introduction
The API Reference contains information on the class hierarchy and member functions of the QCAR SDK. An overview of the SDK is shown below. It provides: Callbacks for events (Example: A new camera image is available) High-level access to hardware units (Example: Camera start/stop) Multiple trackables (tracking types): o Image Targets o Multi Targets o Frame Markers Real-world Interactions o Virtual Buttons

High-level system overview of QCAR-SDK

Appendix - iv

QCAR SDK v1.5 Beta1 Public API Documentation

Namespace Index
Namespace List
Here is a list of all namespaces with brief descriptions: com ................................................................................................................................. 9 com::qualcomm ............................................................................................................ 9 com.qualcomm.QCAR .................................................................................................. 9 QCAR ............................................................................................................................ 10 QCAR::Tool (Tool functions ) ..................................................................................... 15

NOTE: Page numbers are with reference to Appendix.

Appendix - v

QCAR SDK v1.5 Beta1 Public API Documentation

Class Index
Class Hierarchy
This inheritance list is sorted roughly, but not completely, alphabetically: QCAR::Area ................................................................................................................... 17 QCAR::Rectangle ................................................................................................... 50 QCAR::Frame ................................................................................................................ 28 QCAR::Matrix34F .......................................................................................................... 41 QCAR::Matrix44F .......................................................................................................... 42 QCAR::NonCopyable .................................................................................................... 46 QCAR::CameraCalibration..................................................................................... 19 QCAR::CameraDevice ............................................................................................ 21 QCAR::DataSet ....................................................................................................... 25 QCAR::Image .......................................................................................................... 30 QCAR::Renderer ..................................................................................................... 52 QCAR::Trackable .................................................................................................... 56 QCAR::ImageTarget ......................................................................................... 32 QCAR::Marker .................................................................................................. 37 QCAR::MultiTarget ........................................................................................... 43 QCAR::Tracker ........................................................................................................ 59 QCAR::ImageTracker ....................................................................................... 35 QCAR::MarkerTracker ..................................................................................... 39 QCAR::VirtualButton .............................................................................................. 73

com.qualcomm.QCAR.QCAR ...................................................................................... 48 QCAR::State .................................................................................................................. 54 QCAR::TrackerManager ............................................................................................... 61 QCAR::UpdateCallback ................................................................................................ 63 QCAR::Vec2F ................................................................................................................. 64 QCAR::Vec2I .................................................................................................................. 65 QCAR::Vec3F ................................................................................................................. 66 QCAR::Vec3I .................................................................................................................. 67 QCAR::Vec4F ................................................................................................................. 68 QCAR::Vec4I .................................................................................................................. 69 QCAR::VideoBackgroundConfig ................................................................................. 70 QCAR::VideoBackgroundTextureInfo ......................................................................... 71 QCAR::VideoMode ........................................................................................................ 72

NOTE: Page numbers are with reference to Appendix.

Appendix - vi

QCAR SDK v1.5 Beta1 Public API Documentation

Class Index
Class List
Here are the classes, structs, unions and interfaces with brief descriptions: QCAR::Area (Area is the base class for 2D shapes used in QCAR ) ...................... 17 QCAR::CameraCalibration (Holds intrinsic camera parameters ) .......................... 19 QCAR::CameraDevice (Implements access to the phone's built-in camera ) ....... 21 QCAR::DataSet (A container of one or more trackables ) ....................................... 25 QCAR::Frame .............................................................................................................. 28 QCAR::Image (An image as e.g. returned by the CameraDevice object ) .............. 30 QCAR::ImageTarget (A flat natural feature target ) .................................................. 32 QCAR::ImageTracker (ImageTracker class ) ............................................................. 35 QCAR::Marker (A rectangular marker ) ...................................................................... 37 QCAR::MarkerTracker (MarkerTracker class ) .......................................................... 39 QCAR::Matrix34F (Matrix with 3 rows and 4 columns of float items ) .................... 41 QCAR::Matrix44F (Matrix with 4 rows and 4 columns of float items ) .................... 42 QCAR::MultiTarget (A set of multiple targets with a fixed spatial relation ) .......... 43 QCAR::NonCopyable (Base class for objects that can not be copied ) ................. 46 com.qualcomm.QCAR.QCAR .................................................................................... 48 QCAR::Rectangle (Rectangle defines a 2D rectangular area ) ................................ 50 QCAR::Renderer (Renderer class ) ............................................................................ 52 QCAR::State (AR State ) .............................................................................................. 54 QCAR::Trackable (Base class for all objects that can be tracked in 6DOF ) ......... 56 QCAR::Tracker (Base class for all tracker types ) .................................................... 59 QCAR::TrackerManager (TrackerManager class ) .................................................... 61 QCAR::UpdateCallback (UpdateCallback interface ) ............................................... 63 QCAR::Vec2F (2D vector of float items ) ................................................................... 64 QCAR::Vec2I (2D vector of int items ) ........................................................................ 65 QCAR::Vec3F (3D vector of float items ) ................................................................... 66 QCAR::Vec3I (3D vector of int items ) ........................................................................ 67 QCAR::Vec4F (4D vector of float items ) ................................................................... 68 QCAR::Vec4I (4D vector of int items ) ........................................................................ 69 QCAR::VideoBackgroundConfig (Video background configuration ) .................... 70 QCAR::VideoBackgroundTextureInfo (Video background configuration ) ........... 71 QCAR::VideoMode (Implements access to the phone's built-in camera ) ............. 72 QCAR::VirtualButton (A virtual button on a trackable ) ........................................... 73

NOTE: Page numbers are with reference to Appendix.

Appendix - vii

QCAR SDK v1.5 Beta1 Public API Documentation

File Index
File List
Here is a list of all files with brief descriptions: Area.h ........................................................................................................................... 75 CameraCalibration.h ................................................................................................... 76 CameraDevice.h .......................................................................................................... 77 DataSet.h ...................................................................................................................... 78 Frame.h ........................................................................................................................ 79 Image.h ......................................................................................................................... 80 ImageTarget.h .............................................................................................................. 81 ImageTracker.h ............................................................................................................ 82 Marker.h ....................................................................................................................... 83 MarkerTracker.h .......................................................................................................... 84 Matrices.h .................................................................................................................... 85 MultiTarget.h ................................................................................................................ 86 NonCopyable.h ............................................................................................................ 87 QCAR.h ........................................................................................................................ 88 QCAR.java .................................................................................................................... 90 Rectangle.h .................................................................................................................. 91 Renderer.h ................................................................................................................... 92 State.h .......................................................................................................................... 93 System.h ...................................................................................................................... 94 Tool.h ............................................................................................................................ 95 Trackable.h .................................................................................................................. 96 Tracker.h ...................................................................................................................... 97 TrackerManager.h ....................................................................................................... 98 UpdateCallback.h ........................................................................................................ 99 Vectors.h .................................................................................................................... 100 VideoBackgroundConfig.h ....................................................................................... 101 VideoBackgroundTextureInfo.h .............................................................................. 102 VideoMode.h .............................................................................................................. 103 VirtualButton.h .......................................................................................................... 104

NOTE: Page numbers are with reference to Appendix.

Appendix - viii

QCAR SDK v1.5 Beta1 Public API Documentation

Namespace Documentation
com Namespace Reference
Namespaces
namespace qualcomm

com::qualcomm Namespace Reference


Namespaces
package QCAR

Package com.qualcomm.QCAR
Classes
class QCAR

Appendix 9

QCAR SDK v1.5 Beta1 Public API Documentation

QCAR Namespace Reference


Namespaces
namespace Tool

Tool functions.

Classes
class Area Area is the base class for 2D shapes used in QCAR. class CameraCalibration Holds intrinsic camera parameters. class CameraDevice Implements access to the phone's built-in camera. class DataSet A container of one or more trackables. class Frame class Image An image as e.g. returned by the CameraDevice object. class ImageTarget A flat natural feature target. class ImageTracker ImageTracker class. class Marker A rectangular marker. class MarkerTracker MarkerTracker class. struct Matrix34F Matrix with 3 rows and 4 columns of float items. struct Matrix44F Matrix with 4 rows and 4 columns of float items. class MultiTarget A set of multiple targets with a fixed spatial relation. class NonCopyable Base class for objects that can not be copied. class Rectangle Rectangle defines a 2D rectangular area. class Renderer Renderer class. class State AR State. class Trackable Base class for all objects that can be tracked in 6DOF. class Tracker Base class for all tracker types. class TrackerManager TrackerManager class. class UpdateCallback UpdateCallback interface. struct Vec2F 2D vector of float items struct Vec3F 3D vector of float items struct Vec4F 4D vector of float items struct Vec2I 2D vector of int items struct Vec3I 3D vector of int items struct Vec4I 4D vector of int items struct VideoBackgroundConfig Video background configuration. struct VideoBackgroundTextureInfo Video background configuration. struct VideoMode Implements access to the phone's built-in camera. class VirtualButton

A virtual button on a trackable. Enumerations


enum INIT_FLAGS { GL_11 = 1, GL_20 = 2 } Initialization flags. enum { INIT_ERROR = -1, INIT_DEVICE_NOT_SUPPORTED = -2 } Return codes for init() function. enum PIXEL_FORMAT { UNKNOWN_FORMAT = 0, RGB565 = 1, RGB888 = 2, GRAYSCALE = 4, YUV = 8 } Pixel encoding types. enum HINT { HINT_MAX_SIMULTANEOUS_IMAGE_TARGETS = 0, HINT_IMAGE_TARGET_MULTI_FRAME_ENABLED = 1, HINT_IMAGE_TARGET_MILLISECONDS_PER_MULTI_FRAME = 2 }

Appendix 10

QCAR SDK v1.5 Beta1 Public API Documentation

Functions
void QCAR_API deinit () Deinitializes QCAR. bool QCAR_API setHint (unsigned int hint, int value) Sets a hint for the QCAR SDK. void QCAR_API registerCallback (UpdateCallback *object) Registers an object to be called when new tracking data is available. bool QCAR_API setFrameFormat (PIXEL_FORMAT format, bool enabled) Enables the delivery of certain pixel formats via the State object. int QCAR_API getBitsPerPixel (PIXEL_FORMAT format) Returns the number of bits used to store a single pixel of a given format. bool QCAR_API requiresAlpha () int QCAR_API getBufferSize (int width, int height, PIXEL_FORMAT format) Returns the number of bytes for a buffer with a given size and format. void QCAR_API onResume () Executes AR-specific tasks upon the onResume activity event. void QCAR_API onPause () Executes AR-specific tasks upon the onResume activity event. void QCAR_API onSurfaceCreated () Executes AR-specific tasks upon the onSurfaceCreated render surface event. void QCAR_API onSurfaceChanged (int width, int height) Executes AR-specific tasks upon the onSurfaceChanged render surface event. int QCAR_API setInitParameters (int flags) Sets QCAR initialization parameters. int QCAR_API init () Initializes QCAR.

Enumeration Type Documentation


enum QCAR::INIT_FLAGS Initialization flags.

Use when calling QCAR::init()


Enumerator:

GL_11 Enables OpenGL ES 1.1 rendering. GL_20 Enables OpenGL ES 2.0 rendering.
anonymous enum Return codes for init() function. Enumerator:

INIT_ERROR Error during initialization. INIT_DEVICE_NOT_SUPPORTED The device is not supported.

Appendix 11

QCAR SDK v1.5 Beta1 Public API Documentation

enum QCAR::PIXEL_FORMAT Pixel encoding types. Enumerator:

UNKNOWN_FORMAT Unknown format - default pixel type for undefined images RGB565 A color pixel stored in 2 bytes using 5 bits for red, 6 bits for green and 5 bits for blue RGB888 A color pixel stored in 3 bytes using 8 bits each GRAYSCALE A grayscale pixel stored in one byte. YUV A color pixel stored in 12 or more bits using Y, U and V planes
enum QCAR::HINT Use when calling QCAR::setHint() Enumerator:

HINT_MAX_SIMULTANEOUS_IMAGE_TARGETS detect and track at the same time.

How many image targets to

This hint tells the tracker how many image shall be processed at most at the same time. E.g. if an app will never require tracking more than two targets this value should be set to 2. Default is: 1. HINT_IMAGE_TARGET_MULTI_FRAME_ENABLED Enables splitting the detection of new image targets over multiple frames This hint tells the tracker that detection of currently untracked image targets shall be split over multiple frames. The tracker will therefore require less time per frame but longer to find new targets. Default value is 0 (no multi-frame detection). HINT_IMAGE_TARGET_MILLISECONDS_PER_MULTI_FRAME Defines how many milliseconds will be spent on detection and tracking per frame in multi-frame mode Multi-frame mode works time-based: Only as much work is done per frame as fits into a given time budget. The remaining work is postponed to the next frame. The number of frames can be limited using HINT_IMAGE_TARGET_MULTI_FRAME_ENABLED. If this value is set too low, then no targets might ever be detected. This value is only effective if multi-frame detection is enabled. Default value is 25 (milliseconds).

Function Documentation
void QCAR_API QCAR::deinit () Deinitializes QCAR. bool QCAR_API QCAR::setHint (unsigned int hint, int value) Sets a hint for the QCAR SDK.

Hints help the SDK to understand the developer's needs. However, depending on the device or SDK version the hints might not be taken into consideration. Returns false if the hint is unknown or deprecated. For a boolean value 1 means true and 0 means false.

Appendix 12

QCAR SDK v1.5 Beta1 Public API Documentation

void QCAR_API QCAR::registerCallback (UpdateCallback * object) Registers an object to be called when new tracking data is available. bool QCAR_API QCAR::setFrameFormat (PIXEL_FORMAT format, bool enabled) Enables the delivery of certain pixel formats via the State object.

Per default the state object will only contain images in formats that are required for internal processing, such as gray scale for tracking. setFrameFormat() can be used to enforce the creation of images with certain pixel formats. Notice that this might include additional overhead.
int QCAR_API QCAR::getBitsPerPixel (PIXEL_FORMAT format) Returns the number of bits used to store a single pixel of a given format.

Returns 0 if the format is unknown.


bool QCAR_API QCAR::requiresAlpha ()

Indicates whether the rendering surface needs to support an alpha channel for transparency
int QCAR_API QCAR::getBufferSize (int width, int height, PIXEL_FORMAT format) Returns the number of bytes for a buffer with a given size and format.

Returns 0 if the format is unknown.


void QCAR_API QCAR::onResume () Executes AR-specific tasks upon the onResume activity event. void QCAR_API QCAR::onPause () Executes AR-specific tasks upon the onResume activity event. void QCAR_API QCAR::onSurfaceCreated () Executes AR-specific tasks upon the onSurfaceCreated render surface event. void QCAR_API QCAR::onSurfaceChanged (int width, int height) Executes AR-specific tasks upon the onSurfaceChanged render surface event. int QCAR_API QCAR::setInitParameters (int flags) Sets QCAR initialization parameters.

Appendix 13

QCAR SDK v1.5 Beta1 Public API Documentation

Called to set the QCAR initialization parameters prior to calling QCAR::init(). Refer to the enumeration QCAR::INIT_FLAGS for applicable flags. Returns an integer (0 on success).
int QCAR_API QCAR::init () Initializes QCAR.

Called to initialize QCAR. Initialization is progressive, so this function should be called repeatedly until it returns 100 or a negative value. Returns an integer representing the percentage complete (negative on error).

Appendix 14

QCAR SDK v1.5 Beta1 Public API Documentation

QCAR::Tool Namespace Reference


Tool functions.

Functions
QCAR_API Matrix44F convertPose2GLMatrix (const Matrix34F &pose) QCAR_API Matrix44F getProjectionGL (const CameraCalibration &calib, float nearPlane, float farPlane) Returns an OpenGL style projection matrix. QCAR_API Vec2F projectPoint (const CameraCalibration &calib, const Matrix34F &pose, const Vec3F &point) QCAR_API Matrix34F multiply (const Matrix34F &matLeft, const Matrix34F &matRight) Multiplies two QCAR pose matrices. QCAR_API Matrix44F multiply (const Matrix44F &matLeft, const Matrix44F &matRight) Multiplies two QCAR-style 4x4-matrices (row-major order) QCAR_API Matrix44F multiplyGL (const Matrix44F &matLeft, const Matrix44F &matRight) Multiplies two GL-style matrices (col-major order) QCAR_API void setTranslation (Matrix34F &pose, const Vec3F &translation) Sets the translation part of a 3x4 pose matrix. QCAR_API void setRotation (Matrix34F &pose, const Vec3F &axis, float angle) Sets the rotation part of a 3x4 pose matrix using axis-angle as input.

Detailed Description
Tool functions.

Function Documentation
QCAR_API Matrix44F QCAR::Tool::convertPose2GLMatrix (const Matrix34F & pose)

Returns a 4x4 col-major OpenGL model-view matrix from a 3x4 QCAR pose matrix. QCAR uses 3x4 row-major matrices for pose data. convertPose2GLMatrix() takes such a pose matrix and returns an OpenGL compatible model-view matrix.
QCAR_API Matrix44F QCAR::Tool::getProjectionGL (const CameraCalibration & calib, float nearPlane, float farPlane) Returns an OpenGL style projection matrix. QCAR_API Vec2F QCAR::Tool::projectPoint (const CameraCalibration & calib, const Matrix34F & pose, const Vec3F & point)

Projects a 3D scene point into the camera image(device coordinates) given a pose in form of a 3x4 matrix. The projectPoint() function takes a 3D point in scene coordinates and transforms it using the given pose matrix. It then projects it into the camera image (pixel coordinates) using the given camera calibration. Note that camera coordinates are usually different from screen coordinates, since screen and camera resolution can be different. Transforming from camera to screen coordinates requires another

Appendix 15

QCAR SDK v1.5 Beta1 Public API Documentation

transformation using the settings VideoBackgroundConfig structure.

applied

to

the

Renderer

via

the

QCAR_API Matrix34F QCAR::Tool::multiply (const Matrix34F & matLeft, const Matrix34F & matRight) Multiplies two QCAR pose matrices.

In order to apply a transformation A on top of a transformation B, perform: multiply(B,A).


QCAR_API Matrix44F QCAR::Tool::multiply (const Matrix44F & matLeft, const Matrix44F & matRight) Multiplies two QCAR-style 4x4-matrices (row-major order) QCAR_API Matrix44F QCAR::Tool::multiplyGL (const Matrix44F & matLeft, const Matrix44F & matRight) Multiplies two GL-style matrices (col-major order) QCAR_API void QCAR::Tool::setTranslation (Matrix34F & pose, const Vec3F & translation) Sets the translation part of a 3x4 pose matrix. QCAR_API void QCAR::Tool::setRotation (Matrix34F & pose, const Vec3F & axis, float angle) Sets the rotation part of a 3x4 pose matrix using axis-angle as input.

The axis parameter defines the 3D axis around which the pose rotates. The angle parameter defines the angle in degrees for the rotation around that axis.

Appendix 16

QCAR SDK v1.5 Beta1 Public API Documentation

Class Documentation
QCAR::Area Class Reference
Area is the base class for 2D shapes used in QCAR.

#include <Area.h> Inheritance diagram for QCAR::Area:

Public Types
enum TYPE { RECTANGLE, INVALID }

Public Member Functions


virtual TYPE getType () const =0 virtual ~Area ()

Detailed Description
Area is the base class for 2D shapes used in QCAR.

Member Enumeration Documentation


enum QCAR::Area::TYPE Enumerator: RECTANGLE INVALID

Constructor & Destructor Documentation


virtual QCAR::Area::~Area () [virtual]

Member Function Documentation


virtual TYPE QCAR::Area::getType () const [pure virtual] Implemented in QCAR::Rectangle (p.51).

Appendix 17

QCAR SDK v1.5 Beta1 Public API Documentation

The documentation for this class was generated from the following file: Area.h

Appendix 18

QCAR SDK v1.5 Beta1 Public API Documentation

QCAR::CameraCalibration Class Reference


Holds intrinsic camera parameters.

#include <CameraCalibration.h> Inheritance diagram for QCAR::CameraCalibration:

Public Member Functions


virtual Vec2F getSize () const =0 Returns the resolution of the camera as 2D vector. virtual Vec2F getFocalLength () const =0 Returns the focal length in x- and y-direction as 2D vector. virtual Vec2F getPrincipalPoint () const =0 Returns the principal point as 2D vector. virtual Vec4F getDistortionParameters () const =0 Returns the radial distortion as 4D vector.

Detailed Description
Holds intrinsic camera parameters.

Member Function Documentation


virtual Vec2F QCAR::CameraCalibration::getSize () const [pure virtual] Returns the resolution of the camera as 2D vector. virtual Vec2F QCAR::CameraCalibration::getFocalLength () const [pure virtual] Returns the focal length in x- and y-direction as 2D vector. virtual Vec2F QCAR::CameraCalibration::getPrincipalPoint () const [pure virtual] Returns the principal point as 2D vector. virtual Vec4F QCAR::CameraCalibration::getDistortionParameters () const [pure virtual] Returns the radial distortion as 4D vector.

Appendix 19

QCAR SDK v1.5 Beta1 Public API Documentation

The documentation for this class was generated from the following file: CameraCalibration.h

Appendix 20

QCAR SDK v1.5 Beta1 Public API Documentation

QCAR::CameraDevice Class Reference


Implements access to the phone's built-in camera.

#include <CameraDevice.h> Inheritance diagram for QCAR::CameraDevice:

Public Types
enum MODE { MODE_DEFAULT = -1, MODE_OPTIMIZE_SPEED = -2, MODE_OPTIMIZE_QUALITY = -3 } enum FOCUS_MODE { FOCUS_MODE_AUTO, FOCUS_MODE_FIXED, FOCUS_MODE_INFINITY, FOCUS_MODE_MACRO }

Public Member Functions


virtual bool init ()=0 Initializes the camera. virtual bool deinit ()=0 Deinitializes the camera. virtual bool start ()=0 Starts the camera. Frames are being delivered. virtual bool stop ()=0 virtual int getNumVideoModes ()=0 Returns the number of available video modes. virtual VideoMode getVideoMode (int nIndex)=0 Returns the video mode currently selected. virtual bool selectVideoMode (int index)=0 Chooses a video mode out of the list of modes. virtual const CameraCalibration & getCameraCalibration () const =0 Provides read-only access to camera calibration data. virtual bool setFlashTorchMode (bool on)=0 virtual bool startAutoFocus ()=0 virtual bool stopAutoFocus ()=0 virtual bool setFocusMode (int focusMode)=0

Static Public Member Functions


static CameraDevice & getInstance () Returns the CameraDevice singleton instance.

Detailed Description
Implements access to the phone's built-in camera.

Appendix 21

QCAR SDK v1.5 Beta1 Public API Documentation

Member Enumeration Documentation


enum QCAR::CameraDevice::MODE Enumerator:

MODE_DEFAULT Default camera mode. MODE_OPTIMIZE_SPEED Fast camera mode. MODE_OPTIMIZE_QUALITY High-quality camera mode.
enum QCAR::CameraDevice::FOCUS_MODE Enumerator:

FOCUS_MODE_AUTO Default focus mode. FOCUS_MODE_FIXED Fixed focus mode. FOCUS_MODE_INFINITY Focus set to infinity. FOCUS_MODE_MACRO Macro mode for close up focus.

Member Function Documentation


static CameraDevice& QCAR::CameraDevice::getInstance () [static] Returns the CameraDevice singleton instance. virtual bool QCAR::CameraDevice::init () [pure virtual] Initializes the camera. virtual bool QCAR::CameraDevice::deinit () [pure virtual] Deinitializes the camera.

Any resources created or used so far are released. Note that this function should not be called during the execution of the UpdateCallback and if so will return false.
virtual bool QCAR::CameraDevice::start () [pure virtual] Starts the camera. Frames are being delivered.

Depending on the type of the camera it may be necessary to perform configuration tasks before it can be started.
virtual bool QCAR::CameraDevice::stop () [pure virtual]

Stops the camera if video feed is not required (e.g. in non-AR mode of an application).

Appendix 22

QCAR SDK v1.5 Beta1 Public API Documentation

virtual int QCAR::CameraDevice::getNumVideoModes () [pure virtual] Returns the number of available video modes.

This is device specific and can differ between mobile devices or Android versions.
virtual VideoMode QCAR::CameraDevice::getVideoMode (int nIndex) [pure virtual] Returns the video mode currently selected.

If no video mode is set then QCAR chooses a video mode.


virtual bool QCAR::CameraDevice::selectVideoMode (int index) [pure virtual] Chooses a video mode out of the list of modes. virtual const CameraCalibration& QCAR::CameraDevice::getCameraCalibration () const [pure virtual] Provides read-only access to camera calibration data. virtual bool QCAR::CameraDevice::setFlashTorchMode (bool on) [pure virtual]

Enable the torch mode on the device if the device supports this API.
Parameters: on Returns: bool - True if the device supports this and we were able to turn the camera torch on, False otherwise virtual bool QCAR::CameraDevice::startAutoFocus () [pure virtual]

Start the autofocus process. This method will return false if autofocus is not supported on the current device or if autofocus is currently running on the device. True will be returned if an autofocus was successfully requested.
Returns: bool virtual bool QCAR::CameraDevice::stopAutoFocus () [pure virtual]

Stops the autofocus process if it is currently working, otherwise this is a no-op. This method returns false if autofocus is not supported on the current device.
Returns: bool virtual bool QCAR::CameraDevice::setFocusMode (int focusMode) [pure virtual]

Set the active focus mode. This method returns false if the requested focus mode is not supported on this device.
Parameters: focusMode Returns: bool

Appendix 23

QCAR SDK v1.5 Beta1 Public API Documentation

The documentation for this class was generated from the following file: CameraDevice.h

Appendix 24

QCAR SDK v1.5 Beta1 Public API Documentation

QCAR::DataSet Class Reference


A container of one or more trackables.

#include <DataSet.h> Inheritance diagram for QCAR::DataSet:

Public Types
enum STORAGE_TYPE { STORAGE_APP, STORAGE_APPRESOURCE, STORAGE_ABSOLUTE }

Types of storage locations for datasets. Public Member Functions


virtual bool load (const char *path, STORAGE_TYPE storageType)=0 Loads the dataset at the specified path and storage location. virtual int getNumTrackables () const =0 Returns the overall number of 3D trackable objects in this data set. virtual Trackable * getTrackable (int idx)=0 Returns a pointer to a trackable object. virtual MultiTarget * createMultiTarget (const char *name)=0 Creates a new MultiTarget and registers it with the dataset. virtual bool destroy (MultiTarget *multiTarget)=0 Destroys a MultiTarget. virtual ~DataSet ()

Static Public Member Functions


static bool exists (const char *path, STORAGE_TYPE storageType) Checks if the dataset exists at the specified path and storage location.

Detailed Description
A container of one or more trackables. A dataset may contain multiple ImageTargets and MultiTargets. An empty DataSet instance is created using the DataSet factory function provided by the ImageTracker class. The dataset is then loaded given a dataset XML and corresponding dataset DAT file. The dataset may be loaded from the storage locations defined below. Note that the root filename of the dataset DAT file and XML file must be the same. Once loaded the dataset can be activated using ImageTracker::activateDataSet(). Methods to modify a DataSet must not be called while it is active. The DataSet must be deactivated first before reconfiguring it.

Appendix 25

QCAR SDK v1.5 Beta1 Public API Documentation

Member Enumeration Documentation


enum QCAR::DataSet::STORAGE_TYPE Types of storage locations for datasets. Enumerator:

STORAGE_APP Storage private to the application. STORAGE_APPRESOURCE Storage for assets bundled with the application STORAGE_ABSOLUTE Helper type for specifying an absolute path.

Constructor & Destructor Documentation


virtual QCAR::DataSet::~DataSet () [inline, virtual]

Member Function Documentation


static bool QCAR::DataSet::exists (const char * path, STORAGE_TYPE storageType) [static] Checks if the dataset exists at the specified path and storage location.

Returns true if both the dataset XML and DAT file exist at the given storage location. The relative path to the dataset XML must be passed to this function for all storage locations other than STORAGE_ABSOLUTE.
virtual bool QCAR::DataSet::load (const char * path, STORAGE_TYPE storageType) [pure virtual] Loads the dataset at the specified path and storage location.

Returns true if the dataset was loaded successfully. After loading, individual Trackables can be accessed using getNumTrackables() and getTrackable(). The relative path to the dataset XML must be passed to this function for all storage locations other than STORAGE_ABSOLUTE. Note that loading a dataset may take significant time and therefore it is recommended to load datasets in the background.
virtual int QCAR::DataSet::getNumTrackables () const [pure virtual] Returns the overall number of 3D trackable objects in this data set.

Trackables that are part of other trackables (e.g. an ImageTarget that is part of a MultiTarget) is not counted here and not delivered by DataSet::getTrackable().
virtual Trackable* QCAR::DataSet::getTrackable (int idx) [pure virtual] Returns a pointer to a trackable object.

Trackables that are part of other trackables (e.g. an ImageTarget that is part of a MultiTarget) is not delivered by this method. Such trackables can be accesses via the

Appendix 26

QCAR SDK v1.5 Beta1 Public API Documentation

trackable they are part of. E.g. use MultiTarget::getPart() to access the respective ImageTargets.
virtual MultiTarget* QCAR::DataSet::createMultiTarget (const char * name) [pure virtual] Creates a new MultiTarget and registers it with the dataset.

Use DataSet::destroy() to destroy the returned MultiTarget if it is no longer required. This method must not be called while the dataset is active or it will return NULL.
virtual bool QCAR::DataSet::destroy (MultiTarget * multiTarget) [pure virtual] Destroys a MultiTarget.

This method must not be called while the dataset is active or it will return false.

The documentation for this class was generated from the following file: DataSet.h

Appendix 27

QCAR SDK v1.5 Beta1 Public API Documentation

QCAR::Frame Class Reference


#include <Frame.h> Public Member Functions
Frame () Creates a new frame. Frame (const Frame &other) Creates a reference to an existing frame. ~Frame () Destructor. Frame & operator= (const Frame &other) Thread save assignment operator. double getTimeStamp () const A time stamp that defines when the original camera image was shot. int getIndex () const Index of the frame. int getNumImages () const Number of images in the images-array. const Image * getImage (int idx) const Read-only access to an image.

Protected Attributes
FrameData * mData

Detailed Description
Frame is a collection of different representations of a single camerasnapshot A Frame object can include an arbitrary number of image representations in different formats or resolutions together with a time stamp and frame index. Frame implements the RAII pattern: A newly created frame holds new image data whereas copies of the share this data. The image data held by Frame exists as long as one or more Frame objects referencing this image data exist.

Constructor & Destructor Documentation


QCAR::Frame::Frame () Creates a new frame. QCAR::Frame::Frame (const Frame & other) Creates a reference to an existing frame. QCAR::Frame::~Frame ()

Appendix 28

QCAR SDK v1.5 Beta1 Public API Documentation

Destructor.

Member Function Documentation


Frame& QCAR::Frame::operator= (const Frame & other) Thread save assignment operator. double QCAR::Frame::getTimeStamp () const A time stamp that defines when the original camera image was shot.

Value in seconds representing the offset to application startup time. Independent from image creation the time stamp always refers to the time the camera image was shot.
int QCAR::Frame::getIndex () const Index of the frame. int QCAR::Frame::getNumImages () const Number of images in the images-array. const Image* QCAR::Frame::getImage (int idx) const Read-only access to an image.

Member Data Documentation


FrameData* QCAR::Frame::mData [protected]

The documentation for this class was generated from the following file: Frame.h

Appendix 29

QCAR SDK v1.5 Beta1 Public API Documentation

QCAR::Image Class Reference


An image as e.g. returned by the CameraDevice object.

#include <Image.h> Inheritance diagram for QCAR::Image:

Public Member Functions


virtual int getWidth () const =0 Returns the width of the image in pixels. virtual int getHeight () const =0 Returns the height of the image in pixels. virtual int getStride () const =0 Returns the number bytes from one row of pixels to the next row. virtual int getBufferWidth () const =0 Returns the number of pixel columns that fit into the pixel buffer. virtual int getBufferHeight () const =0 Returns the number of rows that fit into the pixel buffer. virtual PIXEL_FORMAT getFormat () const =0 Returns the pixel format of the image. virtual const void * getPixels () const =0 Provides read-only access to pixel data.

Detailed Description
An image as e.g. returned by the CameraDevice object. The image's pixel buffer can have a different size than the getWidth() and getHeight() methods report. This is e.g. the case when an image is used for rendering as a texture without non-power-of-two support. The real size of the image's pixel buffer can be queried using getBufferWidth() and getBufferHeight().

Member Function Documentation


virtual int QCAR::Image::getWidth () const [pure virtual] Returns the width of the image in pixels.

getWidth() returns the number of pixels in the pixel buffer that make up the used image area. The pixel buffer can be wider than this. Use getBufferWidth() to find out the real width of the pixel buffer.

Appendix 30

QCAR SDK v1.5 Beta1 Public API Documentation

virtual int QCAR::Image::getHeight () const [pure virtual] Returns the height of the image in pixels.

getHeight() returns the number of pixel rows in the pixel buffer that make up the used image area. The pixel buffer can have more rows than that. Use getBufferHeight() to find out the real number of rows that fit into the buffer.
virtual int QCAR::Image::getStride () const [pure virtual] Returns the number bytes from one row of pixels to the next row.

Per default the stride is number-of-pixels times bytes-per-pixel. However, in some cases there can be additional padding bytes at the end of a row (e.g. to support power-of-two textures).
virtual int QCAR::Image::getBufferWidth () const [pure virtual] Returns the number of pixel columns that fit into the pixel buffer.

Per default the number of columns that fit into the pixel buffer is identical to the width of the image. However, in some cases there can be additional padding columns at the right side of an image (e.g. to support power-of-two textures).
virtual int QCAR::Image::getBufferHeight () const [pure virtual] Returns the number of rows that fit into the pixel buffer.

Per default the number of rows that fit into the pixel buffer is identical to the height of the image. However, in some cases there can be additional padding rows at the bottom of an image (e.g. to support power-of-two textures).
virtual PIXEL_FORMAT QCAR::Image::getFormat () const [pure virtual] Returns the pixel format of the image. virtual const void* QCAR::Image::getPixels () const [pure virtual] Provides read-only access to pixel data.

The documentation for this class was generated from the following file: Image.h

Appendix 31

QCAR SDK v1.5 Beta1 Public API Documentation

QCAR::ImageTarget Class Reference


A flat natural feature target.

#include <ImageTarget.h> Inheritance diagram for QCAR::ImageTarget:

Public Member Functions


virtual Vec2F getSize () const =0 Returns the size (width and height) of the target (in 3D scene units). virtual bool setSize (const Vec2F &size)=0 Set the size (width and height) of the target (in 3D scene units). virtual int getNumVirtualButtons () const =0 Returns the number of virtual buttons defined for this ImageTarget. virtual VirtualButton * getVirtualButton (int idx)=0 Provides write access to a specific virtual button. virtual const VirtualButton * getVirtualButton (int idx) const =0 Provides read-only access to a specific virtual button. virtual VirtualButton * getVirtualButton (const char *name)=0 Returns a virtual button by its name. virtual const VirtualButton * getVirtualButton (const char *name) const =0 Returns a virtual button by its name. virtual VirtualButton * createVirtualButton (const char *name, const Area &area)=0 Creates a new virtual button and adds it to the ImageTarget. virtual bool destroyVirtualButton (VirtualButton *button)=0 Removes and destroys one of the ImageTarget's virtual buttons.

Detailed Description
A flat natural feature target. Methods to modify an ImageTarget must not be called while the corresponding DataSet is active. The dataset must be deactivated first before reconfiguring an ImageTarget.

Appendix 32

QCAR SDK v1.5 Beta1 Public API Documentation

Member Function Documentation


virtual Vec2F QCAR::ImageTarget::getSize () const [pure virtual] Returns the size (width and height) of the target (in 3D scene units). virtual bool QCAR::ImageTarget::setSize (const Vec2F & size) [pure virtual] Set the size (width and height) of the target (in 3D scene units).

The dataset this ImageTarget belongs to must not be active when calling this function or it will fail. Returns true if the size was set successfully, false otherwise.
virtual int QCAR::ImageTarget::getNumVirtualButtons () const [pure virtual] Returns the number of virtual buttons defined for this ImageTarget. virtual VirtualButton* QCAR::ImageTarget::getVirtualButton (int idx) [pure virtual] Provides write access to a specific virtual button. virtual const VirtualButton* QCAR::ImageTarget::getVirtualButton (int idx) const [pure virtual] Provides read-only access to a specific virtual button. virtual VirtualButton* QCAR::ImageTarget::getVirtualButton (const char * name) [pure virtual] Returns a virtual button by its name.

Returns NULL if no virtual button with that name exists in this ImageTarget
virtual const VirtualButton* QCAR::ImageTarget::getVirtualButton (const char * name) const [pure virtual] Returns a virtual button by its name.

Returns NULL if no virtual button with that name exists in this ImageTarget
virtual VirtualButton* QCAR::ImageTarget::createVirtualButton (const char * name, const Area & area) [pure virtual] Creates a new virtual button and adds it to the ImageTarget.

Returns NULL if the corresponding DataSet is currently active.


virtual bool QCAR::ImageTarget::destroyVirtualButton (VirtualButton * button) [pure virtual] Removes and destroys one of the ImageTarget's virtual buttons.

Appendix 33

QCAR SDK v1.5 Beta1 Public API Documentation

Returns false if the corresponding DataSet is currently active.

The documentation for this class was generated from the following file: ImageTarget.h

Appendix 34

QCAR SDK v1.5 Beta1 Public API Documentation

QCAR::ImageTracker Class Reference


ImageTracker class.

#include <ImageTracker.h> Inheritance diagram for QCAR::ImageTracker:

Public Member Functions


virtual DataSet * createDataSet ()=0 virtual bool destroyDataSet (DataSet *dataset)=0 virtual bool activateDataSet (DataSet *dataset)=0 Activates the given dataset. virtual bool deactivateDataSet (DataSet *dataset)=0 Dectivates the given dataset. virtual DataSet * getActiveDataSet ()=0

Detailed Description
ImageTracker class. The ImageTracker tracks ImageTargets and MultiTargets contained in a DataSet. The ImageTracker class provides methods for creating, activating and deactivating datasets. Note that methods for swapping the active dataset should not be called while the ImageTracker is working at the same time. Doing so will make these methods block and wait until the tracker has finished. The suggested way of swapping datasets is during the execution of UpdateCallback, which guarantees that the ImageTracker is not working concurrently. Alternatively the ImageTracker can be stopped explicitly. However, this is a very expensive operation.

Member Function Documentation


virtual DataSet* QCAR::ImageTracker::createDataSet () [pure virtual]

Factory function for creating an empty dataset. Returns the new instance on success, NULL otherwise.
virtual bool QCAR::ImageTracker::destroyDataSet (DataSet * dataset) [pure virtual]

Destroys the given dataset and releases allocated resources. Returns false if the given dataset is currently active.

Appendix 35

QCAR SDK v1.5 Beta1 Public API Documentation

virtual bool QCAR::ImageTracker::activateDataSet (DataSet * dataset) [pure virtual] Activates the given dataset.

Only a single DataSet can be active at any one time. This function will return true if the DataSet was successfully activated and false otherwise (E.g. because another dataset is already active). The recommended way to swap datasets is during the execution of the UpdateCallback, which guarantees that the ImageTracker is not working concurrently.
virtual bool QCAR::ImageTracker::deactivateDataSet (DataSet * dataset) [pure virtual] Dectivates the given dataset.

This function will return true if the DataSet was successfully deactivated and false otherwise (E.g. because this dataset is not currently active). The recommended way to swap datasets is during the execution of the UpdateCallback, which guarantees that the ImageTracker is not working concurrently.
virtual DataSet* QCAR::ImageTracker::getActiveDataSet () [pure virtual]

Returns the currently active dataset. Returns NULL if no DataSet has been activated.

The documentation for this class was generated from the following file: ImageTracker.h

Appendix 36

QCAR SDK v1.5 Beta1 Public API Documentation

QCAR::Marker Class Reference


A rectangular marker.

#include <Marker.h> Inheritance diagram for QCAR::Marker:

Public Types
enum TYPE { INVALID, ID_FRAME }

Type of markers. Public Member Functions


virtual Vec2F getSize () const =0 Returns the size of the marker in 3D scene units. virtual bool setSize (const Vec2F &size)=0 Sets a new size (in 3D scene units) for the marker. virtual int getMarkerId () const =0 virtual TYPE getMarkerType () const =0

Detailed Description
A rectangular marker.

Member Enumeration Documentation


enum QCAR::Marker::TYPE Type of markers. Enumerator:

INVALID Invalid marker type. ID_FRAME An id-encoded marker that stores the id in the frame
Reimplemented from QCAR::Trackable (p.57).

Appendix 37

QCAR SDK v1.5 Beta1 Public API Documentation

Member Function Documentation


virtual Vec2F QCAR::Marker::getSize () const [pure virtual] Returns the size of the marker in 3D scene units. virtual bool QCAR::Marker::setSize (const Vec2F & size) [pure virtual] Sets a new size (in 3D scene units) for the marker. virtual int QCAR::Marker::getMarkerId () const [pure virtual]

Returns the marker ID (as opposed to the trackable's id, which can be queried using getId())
virtual TYPE QCAR::Marker::getMarkerType () const [pure virtual]

Returns the marker type (as opposed to the trackable's type, which can be queried using getType())

The documentation for this class was generated from the following file: Marker.h

Appendix 38

QCAR SDK v1.5 Beta1 Public API Documentation

QCAR::MarkerTracker Class Reference


MarkerTracker class.

#include <MarkerTracker.h> Inheritance diagram for QCAR::MarkerTracker:

Public Member Functions


virtual Marker * createFrameMarker (int markerId, const char *name, const QCAR::Vec2F &size)=0 Creates a new Marker. virtual bool destroyMarker (Marker *marker)=0 Destroys a Marker. virtual int getNumMarkers () const =0 Returns the total number of Markers that have been created. virtual Marker * getMarker (int idx) const =0 Returns a pointer to a Marker object.

Detailed Description
MarkerTracker class. The MarkerTracker tracks rectangular markers and provides methods for creating and destroying these dynamically. Note that the methods for creating and destroying markers should not be called while the MarkerTracker is working at the same time. Doing so will make these methods block and wait until the MarkerTracker has finished. The suggested way of doing this is during the execution of UpdateCallback, which guarantees that the MarkerTracker is not working concurrently. Alternatively the MarkerTracker can be stopped explicitly.

Member Function Documentation


virtual Marker* QCAR::MarkerTracker::createFrameMarker (int markerId, const char * name, const QCAR::Vec2F & size) [pure virtual] Creates a new Marker.

Creates a new marker of the given name, size and id. Returns the new instance on success, NULL otherwise.

Appendix 39

QCAR SDK v1.5 Beta1 Public API Documentation

virtual bool QCAR::MarkerTracker::destroyMarker (Marker * marker) [pure virtual] Destroys a Marker. virtual int QCAR::MarkerTracker::getNumMarkers () const [pure virtual] Returns the total number of Markers that have been created. virtual Marker* QCAR::MarkerTracker::getMarker (int idx) const [pure virtual] Returns a pointer to a Marker object.

The documentation for this class was generated from the following file: MarkerTracker.h

Appendix 40

QCAR SDK v1.5 Beta1 Public API Documentation

QCAR::Matrix34F Struct Reference


Matrix with 3 rows and 4 columns of float items.

#include <Matrices.h> Public Attributes


float data [3 *4] Array of matrix items.

Detailed Description
Matrix with 3 rows and 4 columns of float items.

Member Data Documentation


float QCAR::Matrix34F::data[3 *4] Array of matrix items.

The documentation for this struct was generated from the following file: Matrices.h

Appendix 41

QCAR SDK v1.5 Beta1 Public API Documentation

QCAR::Matrix44F Struct Reference


Matrix with 4 rows and 4 columns of float items.

#include <Matrices.h> Public Attributes


float data [4 *4] Array of matrix items.

Detailed Description
Matrix with 4 rows and 4 columns of float items.

Member Data Documentation


float QCAR::Matrix44F::data[4 *4] Array of matrix items.

The documentation for this struct was generated from the following file: Matrices.h

Appendix 42

QCAR SDK v1.5 Beta1 Public API Documentation

QCAR::MultiTarget Class Reference


A set of multiple targets with a fixed spatial relation.

#include <MultiTarget.h> Inheritance diagram for QCAR::MultiTarget:

Public Member Functions


virtual int getNumParts () const =0 Returns the number of Trackables that form the MultiTarget. virtual Trackable * getPart (int idx)=0 Provides write access to a specific Trackable. virtual const Trackable * getPart (int idx) const =0 Provides read-only access to a specific Trackable. virtual Trackable * getPart (const char *name)=0 Provides write access to a specific Trackable. virtual const Trackable * getPart (const char *name) const =0 Provides read-only access to a specific Trackable. virtual int addPart (Trackable *trackable)=0 Adds a Trackable to the MultiTarget. virtual bool removePart (int idx)=0 Removes a Trackable from the MultiTarget. virtual bool setPartOffset (int idx, const Matrix34F &offset)=0 Defines a Part's spatial offset to the MultiTarget center. virtual bool getPartOffset (int idx, Matrix34F &offset) const =0 Retrieves the spatial offset of a Part to the MultiTarget center.

Detailed Description
A set of multiple targets with a fixed spatial relation. Methods to modify a MultiTarget must not be called while the corresponding DataSet is active. The dataset must be deactivated first before reconfiguring a MultiTarget.

Appendix 43

QCAR SDK v1.5 Beta1 Public API Documentation

Member Function Documentation


virtual int QCAR::MultiTarget::getNumParts () const [pure virtual] Returns the number of Trackables that form the MultiTarget. virtual Trackable* QCAR::MultiTarget::getPart (int idx) [pure virtual] Provides write access to a specific Trackable.

Returns NULL if the index is invalid.


virtual const Trackable* QCAR::MultiTarget::getPart (int idx) const [pure virtual] Provides read-only access to a specific Trackable.

Returns NULL if the index is invalid.


virtual Trackable* QCAR::MultiTarget::getPart (const char * name) [pure virtual] Provides write access to a specific Trackable.

Returns NULL if no Trackable with the given name exists in the MultiTarget.
virtual const Trackable* QCAR::MultiTarget::getPart (const char * name) const [pure virtual] Provides read-only access to a specific Trackable.

Returns NULL if no Trackable with the given name exists in the MultiTarget.
virtual int QCAR::MultiTarget::addPart (Trackable * trackable) [pure virtual] Adds a Trackable to the MultiTarget.

Returns the index of the new part on success. Returns -1 in case of error, e.g. when adding a Part that is already added or if the corresponding DataSet is currently active. Use the returned index to set the Part's pose via setPartPose().
virtual bool QCAR::MultiTarget::removePart (int idx) [pure virtual] Removes a Trackable from the MultiTarget.

Returns true on success. Returns false if the index is invalid or if the corresponding DataSet is currently active.
virtual bool QCAR::MultiTarget::setPartOffset (int idx, const Matrix34F & offset) [pure virtual] Defines a Part's spatial offset to the MultiTarget center.

Per default a new Part has zero offset (no translation, no rotation). In this case the pose of the Part is identical with the pose of the MultiTarget. If there is more than one Part in

Appendix 44

QCAR SDK v1.5 Beta1 Public API Documentation

a MultiTarget then at least one must have an offset, or the Parts are co-located. Returns false if the index is invalid or if the corresponding DataSet is currently active.
virtual bool QCAR::MultiTarget::getPartOffset (int idx, Matrix34F & offset) const [pure virtual] Retrieves the spatial offset of a Part to the MultiTarget center.

Returns false if the Part's index is invalid.

The documentation for this class was generated from the following file: MultiTarget.h

Appendix 45

QCAR SDK v1.5 Beta1 Public API Documentation

QCAR::NonCopyable Class Reference


Base class for objects that can not be copied.

#include <NonCopyable.h> Inheritance diagram for QCAR::NonCopyable:

Protected Member Functions


NonCopyable () Standard constructor. ~NonCopyable () Standard destructor.

Detailed Description
Base class for objects that can not be copied.

Constructor & Destructor Documentation


QCAR::NonCopyable::NonCopyable () [inline, protected] Standard constructor. QCAR::NonCopyable::~NonCopyable () [inline, protected]

Appendix 46

QCAR SDK v1.5 Beta1 Public API Documentation

Standard destructor.

The documentation for this class was generated from the following file: NonCopyable.h

Appendix 47

QCAR SDK v1.5 Beta1 Public API Documentation

com.qualcomm.QCAR.QCAR Class Reference


Static Public Member Functions
static int init () static void setInitParameters (Activity nActivity, int nFlags) static native boolean isInitialized () static native void deinit () static native boolean requiresAlpha () static native void onResume () static native void onPause () static native void onSurfaceCreated () static native void onSurfaceChanged (int width, int height)

Static Public Attributes


static final int GL_11 = 1 static final int GL_20 = 2 static final int INIT_ERROR = -1 static final int INIT_DEVICE_NOT_SUPPORTED = -2

Member Function Documentation


static int com.qualcomm.QCAR.QCAR.init () [inline, static] static void com.qualcomm.QCAR.QCAR.setInitParameters (Activity nActivity, int nFlags) [inline, static] static native boolean com.qualcomm.QCAR.QCAR.isInitialized () [static] static native void com.qualcomm.QCAR.QCAR.deinit () [static] static native boolean com.qualcomm.QCAR.QCAR.requiresAlpha () [static] static native void com.qualcomm.QCAR.QCAR.onResume () [static] static native void com.qualcomm.QCAR.QCAR.onPause () [static] static native void com.qualcomm.QCAR.QCAR.onSurfaceCreated () [static] static native void com.qualcomm.QCAR.QCAR.onSurfaceChanged (int width, int height) [static]

Appendix 48

QCAR SDK v1.5 Beta1 Public API Documentation

Member Data Documentation


final int com.qualcomm.QCAR.QCAR.GL_11 = 1 [static] final int com.qualcomm.QCAR.QCAR.GL_20 = 2 [static] final int com.qualcomm.QCAR.QCAR.INIT_ERROR = -1 [static] final int com.qualcomm.QCAR.QCAR.INIT_DEVICE_NOT_SUPPORTED = -2 [static]

The documentation for this class was generated from the following file: QCAR.java

Appendix 49

QCAR SDK v1.5 Beta1 Public API Documentation

QCAR::Rectangle Class Reference


Rectangle defines a 2D rectangular area.

#include <Rectangle.h> Inheritance diagram for QCAR::Rectangle:

Public Member Functions


Rectangle () Rectangle (const Rectangle &other) Rectangle (float leftTopX, float leftTopY, float rightBottomX, float rightBottomY) virtual ~Rectangle () Rectangle & operator= (const Rectangle &other) float getLeftTopX () const float getLeftTopY () const float getRightBottomX () const float getRightBottomY () const float getWidth () const float getHeight () const float getAreaSize () const virtual TYPE getType () const

Protected Attributes
float left float top float right float bottom

Detailed Description
Rectangle defines a 2D rectangular area.

Appendix 50

QCAR SDK v1.5 Beta1 Public API Documentation

Constructor & Destructor Documentation


QCAR::Rectangle::Rectangle () QCAR::Rectangle::Rectangle (const Rectangle & other) QCAR::Rectangle::Rectangle (float leftTopX, float leftTopY, float rightBottomX, float rightBottomY) virtual QCAR::Rectangle::~Rectangle () [virtual]

Member Function Documentation


Rectangle& QCAR::Rectangle::operator= (const Rectangle & other) float QCAR::Rectangle::getLeftTopX () const float QCAR::Rectangle::getLeftTopY () const float QCAR::Rectangle::getRightBottomX () const float QCAR::Rectangle::getRightBottomY () const float QCAR::Rectangle::getWidth () const float QCAR::Rectangle::getHeight () const float QCAR::Rectangle::getAreaSize () const virtual TYPE QCAR::Rectangle::getType () const [virtual] Implements QCAR::Area (p.17).

Member Data Documentation


float QCAR::Rectangle::left [protected] float QCAR::Rectangle::top [protected] float QCAR::Rectangle::right [protected] float QCAR::Rectangle::bottom [protected]

The documentation for this class was generated from the following file: Rectangle.h

Appendix 51

QCAR SDK v1.5 Beta1 Public API Documentation

QCAR::Renderer Class Reference


Renderer class.

#include <Renderer.h> Inheritance diagram for QCAR::Renderer:

Public Member Functions


virtual State begin ()=0 virtual bool drawVideoBackground ()=0 virtual void end ()=0 Marks the end of rendering for the current frame. virtual bool bindVideoBackground (int unit)=0 virtual void setVideoBackgroundConfig (const VideoBackgroundConfig &cfg)=0 virtual const VideoBackgroundConfig & getVideoBackgroundConfig () const =0 Retrieves the current layout configuration of the video background. virtual const VideoBackgroundTextureInfo & getVideoBackgroundTextureInfo ()=0 Returns the texture info associated with the current video background. virtual bool setVideoBackgroundTextureID (int textureID)=0 virtual void setARProjection (float nearPlane, float farPlane)=0

Static Public Member Functions


static Renderer & getInstance () Returns the Renderer singleton instance.

Detailed Description
Renderer class. The Renderer class provides methods to fulfill typical AR related tasks such as rendering the video background and 3D objects with up to date pose data. Methods of the Renderer class must only be called from the render thread.

Member Function Documentation


static Renderer& QCAR::Renderer::getInstance () [static] Returns the Renderer singleton instance.

Appendix 52

QCAR SDK v1.5 Beta1 Public API Documentation

virtual State QCAR::Renderer::begin () [pure virtual]

Marks the beginning of rendering for the current frame and returns the State object.
virtual bool QCAR::Renderer::drawVideoBackground () [pure virtual]

Draws the video background This should only be called between a begin() and end() calls
virtual void QCAR::Renderer::end () [pure virtual] Marks the end of rendering for the current frame. virtual bool QCAR::Renderer::bindVideoBackground (int unit) [pure virtual]

Binds the video background texture to a given texture unit This should only be called between a begin() and end() calls
virtual void QCAR::Renderer::setVideoBackgroundConfig (const VideoBackgroundConfig & cfg) [pure virtual]

Configures the layout of the video background (location on the screen and size).
virtual const VideoBackgroundConfig& QCAR::Renderer::getVideoBackgroundConfig () const [pure virtual] Retrieves the current layout configuration of the video background. virtual const VideoBackgroundTextureInfo& QCAR::Renderer::getVideoBackgroundTextureInfo () [pure virtual] Returns the texture info associated with the current video background. virtual bool QCAR::Renderer::setVideoBackgroundTextureID (int textureID) [pure virtual]

Tells QCAR where the texture id to use for updating video background data
virtual void QCAR::Renderer::setARProjection (float nearPlane, float farPlane) [pure virtual]

Tool method to calculate a perspective projection matrix for AR rendering and apply it to OpenGL

The documentation for this class was generated from the following file: Renderer.h

Appendix 53

QCAR SDK v1.5 Beta1 Public API Documentation

QCAR::State Class Reference


AR State.

#include <State.h> Public Member Functions


State () Default constructor. State (const State &other) Copy constructor. ~State () Destructor. State & operator= (const State &other) Thread safe assignment operator. Frame getFrame () const Returns the Frame object that is stored in the State. int getNumTrackables () const Returns the number of Trackable objects currently known to the SDK. const Trackable * getTrackable (int idx) const Provides access to a specific Trackable. int getNumActiveTrackables () const Returns the number of Trackable objects currently being tracked. const Trackable * getActiveTrackable (int idx) const Provides access to a specific Trackable object currently being tracked.

Protected Attributes
StateData * mData

Detailed Description
AR State. A consistent view on the augmented reality state including a camera frame and all trackables. Similar to Frame, State is a light weight object that shares its data among multiple instances. Copies are therefore cheap and suggested over usage of references. Notice: Trackables queried by the state can not be compared by pointer to Trackables queried by the tracker (even though they might reference the same tracked object). Trackables queried by the state represent a temporary and consistent view on the Augmented Reality state and can therefore not be modified. objects must be queried from the Tracker in order to modify them.

Constructor & Destructor Documentation


QCAR::State::State () Default constructor.

Appendix 54

QCAR SDK v1.5 Beta1 Public API Documentation

QCAR::State::State (const State & other) Copy constructor. QCAR::State::~State () Destructor.

Member Function Documentation


State& QCAR::State::operator= (const State & other) Thread safe assignment operator. Frame QCAR::State::getFrame () const Returns the Frame object that is stored in the State. int QCAR::State::getNumTrackables () const Returns the number of Trackable objects currently known to the SDK. const Trackable* QCAR::State::getTrackable (int idx) const Provides access to a specific Trackable.

The returned object is only valid as long as the State object is valid. Do not keep a copy of the pointer!
int QCAR::State::getNumActiveTrackables () const Returns the number of Trackable objects currently being tracked. const Trackable* QCAR::State::getActiveTrackable (int idx) const Provides access to a specific Trackable object currently being tracked.

The returned object is only valid as long as the State object is valid. Do not keep a copy of the pointer!

Member Data Documentation


StateData* QCAR::State::mData [protected]

The documentation for this class was generated from the following file: State.h

Appendix 55

QCAR SDK v1.5 Beta1 Public API Documentation

QCAR::Trackable Class Reference


Base class for all objects that can be tracked in 6DOF.

#include <Trackable.h> Inheritance diagram for QCAR::Trackable:

Public Types
enum TYPE { UNKNOWN_TYPE, IMAGE_TARGET, MULTI_TARGET, MARKER } Types of Trackables. enum STATUS { UNKNOWN, UNDEFINED, NOT_FOUND, DETECTED, TRACKED }

Status of a Trackables. Public Member Functions


virtual TYPE getType () const =0 Returns the type of 3D object (e.g. MARKER) virtual bool isOfType (TYPE type) const =0 Returns true if the object is of or derived of the given type. virtual STATUS getStatus () const =0 Returns the tracking status. virtual int getId () const =0 Returns a unique id for all 3D trackable objects. virtual const char * getName () const =0 Returns the Trackable's name. virtual const Matrix34F & getPose () const =0 Returns the current pose matrix in row-major order. virtual ~Trackable ()

Detailed Description
Base class for all objects that can be tracked in 6DOF. A Trackable is an object who's pose can be estimated in six degrees of freedom (3D, 6DOF). Every Trackable has a name, an id, a type, a pose and a status (e.g. tracked). See the TYPE enum for a list of all classes that derive from Trackable.

Appendix 56

QCAR SDK v1.5 Beta1 Public API Documentation

Member Enumeration Documentation


enum QCAR::Trackable::TYPE Types of Trackables. Enumerator:

UNKNOWN_TYPE A trackable of unknown type. IMAGE_TARGET A trackable of ImageTarget type. MULTI_TARGET A trackable of MultiTarget type. MARKER A trackable of Marker type.
Reimplemented in QCAR::Marker (p.37). enum QCAR::Trackable::STATUS Status of a Trackables. Enumerator:

UNKNOWN The state of the trackable is unknown. UNDEFINED The state of the trackable is not defined (this trackable does not have a state) NOT_FOUND The trackable was not found. DETECTED The trackable was detected. TRACKED The trackable was tracked.

Constructor & Destructor Documentation


virtual QCAR::Trackable::~Trackable () [inline, virtual]

Member Function Documentation


virtual TYPE QCAR::Trackable::getType () const [pure virtual] Returns the type of 3D object (e.g. MARKER) virtual bool QCAR::Trackable::isOfType (TYPE type) const [pure virtual] Returns true if the object is of or derived of the given type. virtual STATUS QCAR::Trackable::getStatus () const [pure virtual] Returns the tracking status. virtual int QCAR::Trackable::getId () const [pure virtual]

Appendix 57

QCAR SDK v1.5 Beta1 Public API Documentation

Returns a unique id for all 3D trackable objects. virtual const char* QCAR::Trackable::getName () const [pure virtual] Returns the Trackable's name. virtual const Matrix34F& QCAR::Trackable::getPose () const [pure virtual] Returns the current pose matrix in row-major order.

The documentation for this class was generated from the following file: Trackable.h

Appendix 58

QCAR SDK v1.5 Beta1 Public API Documentation

QCAR::Tracker Class Reference


Base class for all tracker types.

#include <Tracker.h> Inheritance diagram for QCAR::Tracker:

Public Types
enum TYPE { IMAGE_TRACKER, MARKER_TRACKER }

Enumeration of the different tracker types. Public Member Functions


virtual TYPE getType ()=0 Returns the tracker type. virtual bool start ()=0 Starts the Tracker. virtual void stop ()=0 Stops the Tracker. virtual ~Tracker ()

Detailed Description
Base class for all tracker types. The class exposes generic functionality for starting and stopping a given Tracker as well as querying the tracker type. See the TYPE enum for a list of all classes that derive from Tracker.

Member Enumeration Documentation


enum QCAR::Tracker::TYPE Enumeration of the different tracker types. Enumerator:

IMAGE_TRACKER Tracks ImageTargets and MultiTargets. MARKER_TRACKER Tracks Markers.

Appendix 59

QCAR SDK v1.5 Beta1 Public API Documentation

Constructor & Destructor Documentation


virtual QCAR::Tracker::~Tracker () [inline, virtual]

Member Function Documentation


virtual TYPE QCAR::Tracker::getType () [pure virtual] Returns the tracker type. virtual bool QCAR::Tracker::start () [pure virtual] Starts the Tracker. virtual void QCAR::Tracker::stop () [pure virtual] Stops the Tracker.

The documentation for this class was generated from the following file: Tracker.h

Appendix 60

QCAR SDK v1.5 Beta1 Public API Documentation

QCAR::TrackerManager Class Reference


TrackerManager class.

#include <TrackerManager.h> Public Member Functions


virtual Tracker * initTracker (Tracker::TYPE type)=0 Initializes the tracker of the given type. virtual Tracker * getTracker (Tracker::TYPE type)=0 Returns the instance of the given tracker type. virtual bool deinitTracker (Tracker::TYPE type)=0 Deinitializes the tracker of the given type.

Static Public Member Functions


static TrackerManager & getInstance () Returns the TrackerManager singleton instance.

Detailed Description
TrackerManager class. The TrackerManager singleton provides methods for accessing the trackers available in QCAR as well as initializing specific trackers required by the application. See the Tracker base class for a list of available tracker types.

Member Function Documentation


static TrackerManager& QCAR::TrackerManager::getInstance () [static] Returns the TrackerManager singleton instance. virtual Tracker* QCAR::TrackerManager::initTracker (Tracker::TYPE type) [pure virtual] Initializes the tracker of the given type.

Initializing a tracker must not be done when the CameraDevice is initialized or started. This function will return NULL if the tracker of the given type has already been initialized or if the CameraDevice is currently initialized.
virtual Tracker* QCAR::TrackerManager::getTracker (Tracker::TYPE type) [pure virtual] Returns the instance of the given tracker type.

See the Tracker base class for a list of available tracker classes. This function will return NULL if the tracker of the given type has not been initialized.
virtual bool QCAR::TrackerManager::deinitTracker (Tracker::TYPE type) [pure virtual]

Appendix 61

QCAR SDK v1.5 Beta1 Public API Documentation

Deinitializes the tracker of the given type.

Deinitializes the tracker of the given type and frees any resources used by the tracker. Deinitializing a tracker must not be done when the CameraDevice is initialized or started. This function will return false if the tracker of the given type has not been initialized or if the CameraDevice is currently initialized.

The documentation for this class was generated from the following file: TrackerManager.h

Appendix 62

QCAR SDK v1.5 Beta1 Public API Documentation

QCAR::UpdateCallback Class Reference


UpdateCallback interface.

#include <UpdateCallback.h> Public Member Functions


virtual void QCAR_onUpdate (State &state)=0 Called by the SDK right after tracking finishes.

Detailed Description
UpdateCallback interface.

Member Function Documentation


virtual void QCAR::UpdateCallback::QCAR_onUpdate (State & state) [pure virtual] Called by the SDK right after tracking finishes.

The documentation for this class was generated from the following file: UpdateCallback.h

Appendix 63

QCAR SDK v1.5 Beta1 Public API Documentation

QCAR::Vec2F Struct Reference


2D vector of float items

#include <Vectors.h> Public Member Functions


Vec2F () Vec2F (const float *v) Vec2F (float v0, float v1)

Public Attributes
float data [2]

Detailed Description
2D vector of float items

Constructor & Destructor Documentation


QCAR::Vec2F::Vec2F () [inline] QCAR::Vec2F::Vec2F (const float * v) [inline] QCAR::Vec2F::Vec2F (float v0, float v1) [inline]

Member Data Documentation


float QCAR::Vec2F::data[2]

The documentation for this struct was generated from the following file: Vectors.h

Appendix 64

QCAR SDK v1.5 Beta1 Public API Documentation

QCAR::Vec2I Struct Reference


2D vector of int items

#include <Vectors.h> Public Member Functions


Vec2I () Vec2I (const int *v)

Public Attributes
int data [2]

Detailed Description
2D vector of int items

Constructor & Destructor Documentation


QCAR::Vec2I::Vec2I () [inline] QCAR::Vec2I::Vec2I (const int * v) [inline]

Member Data Documentation


int QCAR::Vec2I::data[2]

The documentation for this struct was generated from the following file: Vectors.h

Appendix 65

QCAR SDK v1.5 Beta1 Public API Documentation

QCAR::Vec3F Struct Reference


3D vector of float items

#include <Vectors.h> Public Member Functions


Vec3F () Vec3F (const float *v) Vec3F (float v0, float v1, float v2)

Public Attributes
float data [3]

Detailed Description
3D vector of float items

Constructor & Destructor Documentation


QCAR::Vec3F::Vec3F () [inline] QCAR::Vec3F::Vec3F (const float * v) [inline] QCAR::Vec3F::Vec3F (float v0, float v1, float v2) [inline]

Member Data Documentation


float QCAR::Vec3F::data[3]

The documentation for this struct was generated from the following file: Vectors.h

Appendix 66

QCAR SDK v1.5 Beta1 Public API Documentation

QCAR::Vec3I Struct Reference


3D vector of int items

#include <Vectors.h> Public Member Functions


Vec3I () Vec3I (const int *v)

Public Attributes
int data [3]

Detailed Description
3D vector of int items

Constructor & Destructor Documentation


QCAR::Vec3I::Vec3I () [inline] QCAR::Vec3I::Vec3I (const int * v) [inline]

Member Data Documentation


int QCAR::Vec3I::data[3]

The documentation for this struct was generated from the following file: Vectors.h

Appendix 67

QCAR SDK v1.5 Beta1 Public API Documentation

QCAR::Vec4F Struct Reference


4D vector of float items

#include <Vectors.h> Public Member Functions


Vec4F () Vec4F (const float *v) Vec4F (float v0, float v1, float v2, float v3)

Public Attributes
float data [4]

Detailed Description
4D vector of float items

Constructor & Destructor Documentation


QCAR::Vec4F::Vec4F () [inline] QCAR::Vec4F::Vec4F (const float * v) [inline] QCAR::Vec4F::Vec4F (float v0, float v1, float v2, float v3) [inline]

Member Data Documentation


float QCAR::Vec4F::data[4]

The documentation for this struct was generated from the following file: Vectors.h

Appendix 68

QCAR SDK v1.5 Beta1 Public API Documentation

QCAR::Vec4I Struct Reference


4D vector of int items

#include <Vectors.h> Public Member Functions


Vec4I () Vec4I (const int *v)

Public Attributes
int data [4]

Detailed Description
4D vector of int items

Constructor & Destructor Documentation


QCAR::Vec4I::Vec4I () [inline] QCAR::Vec4I::Vec4I (const int * v) [inline]

Member Data Documentation


int QCAR::Vec4I::data[4]

The documentation for this struct was generated from the following file: Vectors.h

Appendix 69

QCAR SDK v1.5 Beta1 Public API Documentation

QCAR::VideoBackgroundConfig Struct Reference


Video background configuration.

#include <VideoBackgroundConfig.h> Public Attributes


bool mEnabled Enables/disables rendering of the video background. bool mSynchronous Enables/disables synchronization of video background and tracking data. Vec2I mPosition Vec2I mSize Width and height of the video background in pixels.

Detailed Description
Video background configuration.

Member Data Documentation


bool QCAR::VideoBackgroundConfig::mEnabled Enables/disables rendering of the video background. bool QCAR::VideoBackgroundConfig::mSynchronous Enables/disables synchronization of video background and tracking data.

Depending on the video background rendering mode this may not always be possible. If deactivated the video background always shows the latest camera image.
Vec2I QCAR::VideoBackgroundConfig::mPosition

Relative position of the video background in the render target in pixels. Describes the offset of the center of video background to the center of the screen (viewport) in pixels. A value of (0,0) centers the video background, whereas a value of (-10,15) moves the video background 10 pixels to the left and 15 pixels upwards.
Vec2I QCAR::VideoBackgroundConfig::mSize Width and height of the video background in pixels.

Using the device's screen size for this parameter scales the image to fullscreen. Notice that if the camera's aspect ratio is different than the screen's aspect ratio this will create a non-uniform stretched image.

The documentation for this struct was generated from the following file: VideoBackgroundConfig.h

Appendix 70

QCAR SDK v1.5 Beta1 Public API Documentation

QCAR::VideoBackgroundTextureInfo Struct Reference


Video background configuration.

#include <VideoBackgroundTextureInfo.h> Public Attributes


Vec2I mTextureSize Width and height of the video background texture in pixels. Vec2I mImageSize Width and height of the video background image in pixels. PIXEL_FORMAT mPixelFormat Format of the video background image.

Detailed Description
Video background configuration.

Member Data Documentation


Vec2I QCAR::VideoBackgroundTextureInfo::mTextureSize Width and height of the video background texture in pixels.

Describes the size of the texture in the graphics unit depending on the particular hardware it will be a power of two value immediately after the image size
Vec2I QCAR::VideoBackgroundTextureInfo::mImageSize Width and height of the video background image in pixels.

Describe the size of the image inside the texture. This corresponds to the size of the image delivered by the camera
PIXEL_FORMAT QCAR::VideoBackgroundTextureInfo::mPixelFormat Format of the video background image.

Describe the pixel format of the camera image.

The documentation for this struct was generated from the following file: VideoBackgroundTextureInfo.h

Appendix 71

QCAR SDK v1.5 Beta1 Public API Documentation

QCAR::VideoMode Struct Reference


Implements access to the phone's built-in camera.

#include <VideoMode.h> Public Member Functions


VideoMode ()

Public Attributes
int mWidth Video frame width. int mHeight Video frame height. float mFramerate Video frame rate.

Detailed Description
Implements access to the phone's built-in camera.

Constructor & Destructor Documentation


QCAR::VideoMode::VideoMode () [inline]

Member Data Documentation


int QCAR::VideoMode::mWidth Video frame width. int QCAR::VideoMode::mHeight Video frame height. float QCAR::VideoMode::mFramerate Video frame rate.

The documentation for this struct was generated from the following file: VideoMode.h

Appendix 72

QCAR SDK v1.5 Beta1 Public API Documentation

QCAR::VirtualButton Class Reference


A virtual button on a trackable.

#include <VirtualButton.h> Inheritance diagram for QCAR::VirtualButton:

Public Types
enum SENSITIVITY { HIGH, MEDIUM, LOW }

Sensitivity of press detection. Public Member Functions


virtual bool setArea (const Area &area)=0 virtual const Area & getArea () const =0 Returns the currently set Area. virtual bool setSensitivity (SENSITIVITY sensitivity)=0 Sets the sensitivity of the virtual button. virtual bool setEnabled (bool enabled)=0 Enables or disables a virtual button. virtual bool isEnabled () const =0 Returns true if the virtual button is active (updates while tracking). virtual const char * getName () const =0 Returns the name of the button as ASCII string. virtual bool isPressed () const =0 Returns true if the virtual button is pressed. virtual int getID () const =0 Returns a unique id for this virtual button.

Detailed Description
A virtual button on a trackable. Methods to modify a VirtualButton must not be called while the corresponding DataSet is active. The dataset must be deactivated first before reconfiguring a VirtualButton.

Member Enumeration Documentation


enum QCAR::VirtualButton::SENSITIVITY Sensitivity of press detection. Enumerator:

HIGH Fast detection.

Appendix 73

QCAR SDK v1.5 Beta1 Public API Documentation

MEDIUM Balananced between fast and robust. LOW Robust detection.

Member Function Documentation


virtual bool QCAR::VirtualButton::setArea (const Area & area) [pure virtual]

Defines a new area for the button area in 3D scene units (the coordinate system is local to the ImageTarget). This method must not be called while the corresponding DataSet is active or it will return false.
virtual const Area& QCAR::VirtualButton::getArea () const [pure virtual] Returns the currently set Area. virtual bool QCAR::VirtualButton::setSensitivity (SENSITIVITY sensitivity) [pure virtual] Sets the sensitivity of the virtual button.

Sensitivity allows deciding between fast and robust button press measurements. This method must not be called while the corresponding DataSet is active or it will return false.
virtual bool QCAR::VirtualButton::setEnabled (bool enabled) [pure virtual] Enables or disables a virtual button.

This method must not be called while the corresponding DataSet is active or it will return false.
virtual bool QCAR::VirtualButton::isEnabled () const [pure virtual] Returns true if the virtual button is active (updates while tracking). virtual const char* QCAR::VirtualButton::getName () const [pure virtual] Returns the name of the button as ASCII string. virtual bool QCAR::VirtualButton::isPressed () const [pure virtual] Returns true if the virtual button is pressed. virtual int QCAR::VirtualButton::getID () const [pure virtual] Returns a unique id for this virtual button.

The documentation for this class was generated from the following file: VirtualButton.h

Appendix 74

QCAR SDK v1.5 Beta1 Public API Documentation

File Documentation
Area.h File Reference
#include <QCAR/QCAR.h>
Include dependency graph for Area.h:

This graph shows which files directly or indirectly include this file:

Classes
class QCAR::Area

Area is the base class for 2D shapes used in QCAR. Namespaces


namespace QCAR

Appendix 75

QCAR SDK v1.5 Beta1 Public API Documentation

CameraCalibration.h File Reference


#include <QCAR/Vectors.h> #include <QCAR/NonCopyable.h>
Include dependency graph for CameraCalibration.h:

This graph shows which files directly or indirectly include this file:

Classes
class QCAR::CameraCalibration

Holds intrinsic camera parameters. Namespaces


namespace QCAR

Appendix 76

QCAR SDK v1.5 Beta1 Public API Documentation

CameraDevice.h File Reference


#include <QCAR/NonCopyable.h> #include <QCAR/VideoMode.h> #include <QCAR/CameraCalibration.h>
Include dependency graph for CameraDevice.h:

Classes
class QCAR::CameraDevice

Implements access to the phone's built-in camera. Namespaces


namespace QCAR

Appendix 77

QCAR SDK v1.5 Beta1 Public API Documentation

DataSet.h File Reference


#include <QCAR/NonCopyable.h> #include <QCAR/System.h>
Include dependency graph for DataSet.h:

Classes
class QCAR::DataSet

A container of one or more trackables. Namespaces


namespace QCAR

Appendix 78

QCAR SDK v1.5 Beta1 Public API Documentation

Frame.h File Reference


#include <QCAR/QCAR.h>
Include dependency graph for Frame.h:

This graph shows which files directly or indirectly include this file:

Classes
class QCAR::Frame

Namespaces
namespace QCAR

Appendix 79

QCAR SDK v1.5 Beta1 Public API Documentation

Image.h File Reference


#include <QCAR/QCAR.h> #include <QCAR/NonCopyable.h>
Include dependency graph for Image.h:

Classes
class QCAR::Image

An image as e.g. returned by the CameraDevice object. Namespaces


namespace QCAR

Appendix 80

QCAR SDK v1.5 Beta1 Public API Documentation

ImageTarget.h File Reference


#include <QCAR/Trackable.h> #include <QCAR/Vectors.h>
Include dependency graph for ImageTarget.h:

Classes
class QCAR::ImageTarget

A flat natural feature target. Namespaces


namespace QCAR

Appendix 81

QCAR SDK v1.5 Beta1 Public API Documentation

ImageTracker.h File Reference


#include <QCAR/Tracker.h>
Include dependency graph for ImageTracker.h:

Classes
class QCAR::ImageTracker

ImageTracker class. Namespaces


namespace QCAR

Appendix 82

QCAR SDK v1.5 Beta1 Public API Documentation

Marker.h File Reference


#include <QCAR/Trackable.h> #include <QCAR/Matrices.h> #include <QCAR/Vectors.h>
Include dependency graph for Marker.h:

Classes
class QCAR::Marker

A rectangular marker. Namespaces


namespace QCAR

Appendix 83

QCAR SDK v1.5 Beta1 Public API Documentation

MarkerTracker.h File Reference


#include <QCAR/Tracker.h> #include <QCAR/Vectors.h>
Include dependency graph for MarkerTracker.h:

Classes
class QCAR::MarkerTracker

MarkerTracker class. Namespaces


namespace QCAR

Appendix 84

QCAR SDK v1.5 Beta1 Public API Documentation

Matrices.h File Reference


This graph shows which files directly or indirectly include this file:

Classes
struct QCAR::Matrix34F Matrix with 3 rows and 4 columns of float items. struct QCAR::Matrix44F

Matrix with 4 rows and 4 columns of float items. Namespaces


namespace QCAR

Appendix 85

QCAR SDK v1.5 Beta1 Public API Documentation

MultiTarget.h File Reference


#include <QCAR/Trackable.h> #include <QCAR/Matrices.h>
Include dependency graph for MultiTarget.h:

Classes
class QCAR::MultiTarget

A set of multiple targets with a fixed spatial relation. Namespaces


namespace QCAR

Appendix 86

QCAR SDK v1.5 Beta1 Public API Documentation

NonCopyable.h File Reference


#include <QCAR/System.h>
Include dependency graph for NonCopyable.h:

This graph shows which files directly or indirectly include this file:

Classes
class QCAR::NonCopyable

Base class for objects that can not be copied. Namespaces


namespace QCAR

Appendix 87

QCAR SDK v1.5 Beta1 Public API Documentation

QCAR.h File Reference


#include <QCAR/System.h>
Include dependency graph for QCAR.h:

This graph shows which files directly or indirectly include this file:

Namespaces
namespace QCAR

Enumerations
enum QCAR::INIT_FLAGS { QCAR::GL_11 = 1, QCAR::GL_20 = 2 } Initialization flags. enum { QCAR::INIT_ERROR = -1, QCAR::INIT_DEVICE_NOT_SUPPORTED = -2 } Return codes for init() function. enum QCAR::PIXEL_FORMAT { QCAR::UNKNOWN_FORMAT = 0, QCAR::RGB565 = 1, QCAR::RGB888 = 2, QCAR::GRAYSCALE = 4, QCAR::YUV = 8 } Pixel encoding types. enum QCAR::HINT { QCAR::HINT_MAX_SIMULTANEOUS_IMAGE_TARGETS = 0, QCAR::HINT_IMAGE_TARGET_MULTI_FRAME_ENABLED = 1, QCAR::HINT_IMAGE_TARGET_MILLISECONDS_PER_MULTI_FRAME = 2 }

Use when calling QCAR::setHint() Functions


void QCAR_API QCAR::deinit () Deinitializes QCAR. bool QCAR_API QCAR::setHint (unsigned int hint, int value) Sets a hint for the QCAR SDK. void QCAR_API QCAR::registerCallback (UpdateCallback *object) Registers an object to be called when new tracking data is available.

Appendix 88

QCAR SDK v1.5 Beta1 Public API Documentation

bool QCAR_API QCAR::setFrameFormat (PIXEL_FORMAT format, bool enabled) Enables the delivery of certain pixel formats via the State object. int QCAR_API QCAR::getBitsPerPixel (PIXEL_FORMAT format) Returns the number of bits used to store a single pixel of a given format. bool QCAR_API QCAR::requiresAlpha () int QCAR_API QCAR::getBufferSize (int width, int height, PIXEL_FORMAT format) Returns the number of bytes for a buffer with a given size and format. void QCAR_API QCAR::onResume () Executes AR-specific tasks upon the onResume activity event. void QCAR_API QCAR::onPause () Executes AR-specific tasks upon the onResume activity event. void QCAR_API QCAR::onSurfaceCreated () Executes AR-specific tasks upon the onSurfaceCreated render surface event. void QCAR_API QCAR::onSurfaceChanged (int width, int height) Executes AR-specific tasks upon the onSurfaceChanged render surface event.

Appendix 89

QCAR SDK v1.5 Beta1 Public API Documentation

QCAR.java File Reference


Classes
class com.qualcomm.QCAR.QCAR

Namespaces
package com.qualcomm.QCAR

Appendix 90

QCAR SDK v1.5 Beta1 Public API Documentation

Rectangle.h File Reference


#include <QCAR/Area.h>
Include dependency graph for Rectangle.h:

Classes
class QCAR::Rectangle

Rectangle defines a 2D rectangular area. Namespaces


namespace QCAR

Appendix 91

QCAR SDK v1.5 Beta1 Public API Documentation

Renderer.h File Reference


#include #include #include #include #include <QCAR/Matrices.h> <QCAR/Vectors.h> <QCAR/State.h> <QCAR/NonCopyable.h> <QCAR/QCAR.h>

Include dependency graph for Renderer.h:

Classes
class QCAR::Renderer

Renderer class. Namespaces


namespace QCAR

Appendix 92

QCAR SDK v1.5 Beta1 Public API Documentation

State.h File Reference


#include <QCAR/System.h> #include <QCAR/Frame.h>
Include dependency graph for State.h:

This graph shows which files directly or indirectly include this file:

Classes
class QCAR::State

AR State. Namespaces
namespace QCAR

Appendix 93

QCAR SDK v1.5 Beta1 Public API Documentation

System.h File Reference


This graph shows which files directly or indirectly include this file:

Defines
#define QCAR_API __attribute__((visibility("default")))

Define Documentation
#define QCAR_API __attribute__((visibility("default")))

Appendix 94

QCAR SDK v1.5 Beta1 Public API Documentation

Tool.h File Reference


#include <QCAR/System.h> #include <QCAR/Matrices.h> #include <QCAR/Vectors.h>
Include dependency graph for Tool.h:

Namespaces
namespace QCAR namespace QCAR::Tool

Tool functions.

Functions
QCAR_API Matrix44F QCAR::Tool::convertPose2GLMatrix (const Matrix34F &pose) QCAR_API Matrix44F QCAR::Tool::getProjectionGL (const CameraCalibration &calib, float nearPlane, float farPlane) Returns an OpenGL style projection matrix. QCAR_API Vec2F QCAR::Tool::projectPoint (const CameraCalibration &calib, const Matrix34F &pose, const Vec3F &point) QCAR_API Matrix34F QCAR::Tool::multiply (const Matrix34F &matLeft, const Matrix34F &matRight) Multiplies two QCAR pose matrices. QCAR_API Matrix44F QCAR::Tool::multiply (const Matrix44F &matLeft, const Matrix44F &matRight) Multiplies two QCAR-style 4x4-matrices (row-major order) QCAR_API Matrix44F QCAR::Tool::multiplyGL (const Matrix44F &matLeft, const Matrix44F &matRight) Multiplies two GL-style matrices (col-major order) QCAR_API void QCAR::Tool::setTranslation (Matrix34F &pose, const Vec3F &translation) Sets the translation part of a 3x4 pose matrix. QCAR_API void QCAR::Tool::setRotation (Matrix34F &pose, const Vec3F &axis, float angle) Sets the rotation part of a 3x4 pose matrix using axis-angle as input.

Appendix 95

QCAR SDK v1.5 Beta1 Public API Documentation

Trackable.h File Reference


#include <QCAR/NonCopyable.h> #include <QCAR/Matrices.h> #include <QCAR/System.h>
Include dependency graph for Trackable.h:

This graph shows which files directly or indirectly include this file:

Classes
class QCAR::Trackable

Base class for all objects that can be tracked in 6DOF. Namespaces
namespace QCAR

Appendix 96

QCAR SDK v1.5 Beta1 Public API Documentation

Tracker.h File Reference


#include <QCAR/NonCopyable.h>
Include dependency graph for Tracker.h:

This graph shows which files directly or indirectly include this file:

Classes
class QCAR::Tracker

Base class for all tracker types. Namespaces


namespace QCAR

Appendix 97

QCAR SDK v1.5 Beta1 Public API Documentation

TrackerManager.h File Reference


#include <QCAR/Tracker.h>
Include dependency graph for TrackerManager.h:

Classes
class QCAR::TrackerManager

TrackerManager class. Namespaces


namespace QCAR

Appendix 98

QCAR SDK v1.5 Beta1 Public API Documentation

UpdateCallback.h File Reference


#include <QCAR/System.h>
Include dependency graph for UpdateCallback.h:

Classes
class QCAR::UpdateCallback

UpdateCallback interface. Namespaces


namespace QCAR

Appendix 99

QCAR SDK v1.5 Beta1 Public API Documentation

Vectors.h File Reference


This graph shows which files directly or indirectly include this file:

Classes
struct QCAR::Vec2F 2D vector of float items struct QCAR::Vec3F 3D vector of float items struct QCAR::Vec4F 4D vector of float items struct QCAR::Vec2I 2D vector of int items struct QCAR::Vec3I 3D vector of int items struct QCAR::Vec4I

4D vector of int items Namespaces


namespace QCAR

Appendix 100

QCAR SDK v1.5 Beta1 Public API Documentation

VideoBackgroundConfig.h File Reference


#include <QCAR/Vectors.h>
Include dependency graph for VideoBackgroundConfig.h:

Classes
struct QCAR::VideoBackgroundConfig

Video background configuration. Namespaces


namespace QCAR

Appendix 101

QCAR SDK v1.5 Beta1 Public API Documentation

VideoBackgroundTextureInfo.h File Reference


#include <QCAR/Vectors.h> #include <QCAR/QCAR.h>
Include dependency graph for VideoBackgroundTextureInfo.h:

Classes
struct QCAR::VideoBackgroundTextureInfo

Video background configuration. Namespaces


namespace QCAR

Appendix 102

QCAR SDK v1.5 Beta1 Public API Documentation

VideoMode.h File Reference


This graph shows which files directly or indirectly include this file:

Classes
struct QCAR::VideoMode

Implements access to the phone's built-in camera. Namespaces


namespace QCAR

Appendix 103

QCAR SDK v1.5 Beta1 Public API Documentation

VirtualButton.h File Reference


#include <QCAR/NonCopyable.h> #include <QCAR/Vectors.h>
Include dependency graph for VirtualButton.h:

Classes
class QCAR::VirtualButton

A virtual button on a trackable. Namespaces


namespace QCAR

Appendix 104

QCAR SDK v1.5 Beta1 Public API Documentation

Index
~Area QCAR::Area, 17 ~DataSet QCAR::DataSet, 26 ~Frame QCAR::Frame, 28 ~NonCopyable QCAR::NonCopyable, 46 ~Rectangle QCAR::Rectangle, 51 ~State QCAR::State, 55 ~Trackable QCAR::Trackable, 57 ~Tracker QCAR::Tracker, 60 activateDataSet QCAR::ImageTracker, 36 addPart QCAR::MultiTarget, 44 Area.h, 75 begin QCAR::Renderer, 53 bindVideoBackground QCAR::Renderer, 53 bottom QCAR::Rectangle, 51 CameraCalibration.h, 76 CameraDevice.h, 77 com, 9 com.qualcomm.QCAR, 9 com.qualcomm.QCAR.QCAR, 48 com::qualcomm, 9 com::qualcomm::QCAR::QCAR deinit, 48 GL_11, 49 GL_20, 49 init, 48 INIT_DEVICE_NOT_SUPPORTED, 49 INIT_ERROR, 49 isInitialized, 48 onPause, 48 onResume, 48 onSurfaceChanged, 48 onSurfaceCreated, 48 requiresAlpha, 48 setInitParameters, 48 convertPose2GLMatrix QCAR::Tool, 15 createDataSet QCAR::ImageTracker, 35 createFrameMarker QCAR::MarkerTracker, 39 createMultiTarget QCAR::DataSet, 27 createVirtualButton QCAR::ImageTarget, 33 data QCAR::Matrix34F, 41 QCAR::Matrix44F, 42 QCAR::Vec2F, 64 QCAR::Vec2I, 65 QCAR::Vec3F, 66 QCAR::Vec3I, 67 QCAR::Vec4F, 68 QCAR::Vec4I, 69 DataSet.h, 78 deactivateDataSet QCAR::ImageTracker, 36 deinit com::qualcomm::QCAR::QCAR, 48 QCAR, 12 QCAR::CameraDevice, 22 deinitTracker QCAR::TrackerManager, 61 destroy QCAR::DataSet, 27 destroyDataSet QCAR::ImageTracker, 35 destroyMarker QCAR::MarkerTracker, 40 destroyVirtualButton QCAR::ImageTarget, 33 DETECTED QCAR::Trackable, 57 drawVideoBackground QCAR::Renderer, 53 end QCAR::Renderer, 53 exists QCAR::DataSet, 26 FOCUS_MODE QCAR::CameraDevice, 22 FOCUS_MODE_AUTO QCAR::CameraDevice, 22 FOCUS_MODE_FIXED QCAR::CameraDevice, 22 FOCUS_MODE_INFINITY QCAR::CameraDevice, 22 FOCUS_MODE_MACRO QCAR::CameraDevice, 22 Frame QCAR::Frame, 28 Frame.h, 79 getActiveDataSet QCAR::ImageTracker, 36 getActiveTrackable QCAR::State, 55

Appendix - 105

QCAR SDK v1.5 Beta1 Public API Documentation

getArea QCAR::VirtualButton, 74 getAreaSize QCAR::Rectangle, 51 getBitsPerPixel QCAR, 13 getBufferHeight QCAR::Image, 31 getBufferSize QCAR, 13 getBufferWidth QCAR::Image, 31 getCameraCalibration QCAR::CameraDevice, 23 getDistortionParameters QCAR::CameraCalibration, 19 getFocalLength QCAR::CameraCalibration, 19 getFormat QCAR::Image, 31 getFrame QCAR::State, 55 getHeight QCAR::Image, 31 QCAR::Rectangle, 51 getId QCAR::Trackable, 57 getID QCAR::VirtualButton, 74 getImage QCAR::Frame, 29 getIndex QCAR::Frame, 29 getInstance QCAR::CameraDevice, 22 QCAR::Renderer, 52 QCAR::TrackerManager, 61 getLeftTopX QCAR::Rectangle, 51 getLeftTopY QCAR::Rectangle, 51 getMarker QCAR::MarkerTracker, 40 getMarkerId QCAR::Marker, 38 getMarkerType QCAR::Marker, 38 getName QCAR::Trackable, 58 QCAR::VirtualButton, 74 getNumActiveTrackables QCAR::State, 55 getNumImages QCAR::Frame, 29 getNumMarkers QCAR::MarkerTracker, 40 getNumParts QCAR::MultiTarget, 44 getNumTrackables QCAR::DataSet, 26

QCAR::State, 55 getNumVideoModes QCAR::CameraDevice, 23 getNumVirtualButtons QCAR::ImageTarget, 33 getPart QCAR::MultiTarget, 44 getPartOffset QCAR::MultiTarget, 45 getPixels QCAR::Image, 31 getPose QCAR::Trackable, 58 getPrincipalPoint QCAR::CameraCalibration, 19 getProjectionGL QCAR::Tool, 15 getRightBottomX QCAR::Rectangle, 51 getRightBottomY QCAR::Rectangle, 51 getSize QCAR::CameraCalibration, 19 QCAR::ImageTarget, 33 QCAR::Marker, 38 getStatus QCAR::Trackable, 57 getStride QCAR::Image, 31 getTimeStamp QCAR::Frame, 29 getTrackable QCAR::DataSet, 26 QCAR::State, 55 getTracker QCAR::TrackerManager, 61 getType QCAR::Area, 17 QCAR::Rectangle, 51 QCAR::Trackable, 57 QCAR::Tracker, 60 getVideoBackgroundConfig QCAR::Renderer, 53 getVideoBackgroundTextureInfo QCAR::Renderer, 53 getVideoMode QCAR::CameraDevice, 23 getVirtualButton QCAR::ImageTarget, 33 getWidth QCAR::Image, 30 QCAR::Rectangle, 51 GL_11 com::qualcomm::QCAR::QCAR, 49 QCAR, 11 GL_20 com::qualcomm::QCAR::QCAR, 49 QCAR, 11 GRAYSCALE QCAR, 12

Appendix - 106

QCAR SDK v1.5 Beta1 Public API Documentation

HIGH QCAR::VirtualButton, 73 HINT QCAR, 12 HINT_IMAGE_TARGET_MILLISECONDS_PE R_MULTI_FRAME QCAR, 12 HINT_IMAGE_TARGET_MULTI_FRAME_EN ABLED QCAR, 12 HINT_MAX_SIMULTANEOUS_IMAGE_TARG ETS QCAR, 12 ID_FRAME QCAR::Marker, 37 Image.h, 80 IMAGE_TARGET QCAR::Trackable, 57 IMAGE_TRACKER QCAR::Tracker, 59 ImageTarget.h, 81 ImageTracker.h, 82 init com::qualcomm::QCAR::QCAR, 48 QCAR, 14 QCAR::CameraDevice, 22 INIT_DEVICE_NOT_SUPPORTED com::qualcomm::QCAR::QCAR, 49 QCAR, 11 INIT_ERROR com::qualcomm::QCAR::QCAR, 49 QCAR, 11 INIT_FLAGS QCAR, 11 initTracker QCAR::TrackerManager, 61 INVALID QCAR::Area, 17 QCAR::Marker, 37 isEnabled QCAR::VirtualButton, 74 isInitialized com::qualcomm::QCAR::QCAR, 48 isOfType QCAR::Trackable, 57 isPressed QCAR::VirtualButton, 74 left QCAR::Rectangle, 51 load QCAR::DataSet, 26 LOW QCAR::VirtualButton, 74 MARKER QCAR::Trackable, 57 Marker.h, 83 MARKER_TRACKER QCAR::Tracker, 59 MarkerTracker.h, 84 Matrices.h, 85

mData QCAR::Frame, 29 QCAR::State, 55 MEDIUM QCAR::VirtualButton, 74 mEnabled QCAR::VideoBackgroundConfig, 70 mFramerate QCAR::VideoMode, 72 mHeight QCAR::VideoMode, 72 mImageSize QCAR::VideoBackgroundTextureInfo, 71 MODE QCAR::CameraDevice, 22 MODE_DEFAULT QCAR::CameraDevice, 22 MODE_OPTIMIZE_QUALITY QCAR::CameraDevice, 22 MODE_OPTIMIZE_SPEED QCAR::CameraDevice, 22 mPixelFormat QCAR::VideoBackgroundTextureInfo, 71 mPosition QCAR::VideoBackgroundConfig, 70 mSize QCAR::VideoBackgroundConfig, 70 mSynchronous QCAR::VideoBackgroundConfig, 70 mTextureSize QCAR::VideoBackgroundTextureInfo, 71 MULTI_TARGET QCAR::Trackable, 57 multiply QCAR::Tool, 16 multiplyGL QCAR::Tool, 16 MultiTarget.h, 86 mWidth QCAR::VideoMode, 72 NonCopyable QCAR::NonCopyable, 46 NonCopyable.h, 87 NOT_FOUND QCAR::Trackable, 57 onPause com::qualcomm::QCAR::QCAR, 48 QCAR, 13 onResume com::qualcomm::QCAR::QCAR, 48 QCAR, 13 onSurfaceChanged com::qualcomm::QCAR::QCAR, 48 QCAR, 13 onSurfaceCreated com::qualcomm::QCAR::QCAR, 48 QCAR, 13 operator= QCAR::Frame, 29 QCAR::Rectangle, 51

Appendix - 107

QCAR SDK v1.5 Beta1 Public API Documentation

QCAR::State, 55 PIXEL_FORMAT QCAR, 12 projectPoint QCAR::Tool, 15 QCAR, 10 deinit, 12 getBitsPerPixel, 13 getBufferSize, 13 GL_11, 11 GL_20, 11 GRAYSCALE, 12 HINT, 12 HINT_IMAGE_TARGET_MILLISECONDS_ PER_MULTI_FRAME, 12 HINT_IMAGE_TARGET_MULTI_FRAME_E NABLED, 12 HINT_MAX_SIMULTANEOUS_IMAGE_TA RGETS, 12 init, 14 INIT_DEVICE_NOT_SUPPORTED, 11 INIT_ERROR, 11 INIT_FLAGS, 11 onPause, 13 onResume, 13 onSurfaceChanged, 13 onSurfaceCreated, 13 PIXEL_FORMAT, 12 registerCallback, 13 requiresAlpha, 13 RGB565, 12 RGB888, 12 setFrameFormat, 13 setHint, 12 setInitParameters, 13 UNKNOWN_FORMAT, 12 YUV, 12 QCAR.h, 88 QCAR.java, 90 QCAR::Area, 17 ~Area, 17 getType, 17 INVALID, 17 RECTANGLE, 17 TYPE, 17 QCAR::CameraCalibration, 19 getDistortionParameters, 19 getFocalLength, 19 getPrincipalPoint, 19 getSize, 19 QCAR::CameraDevice, 21 deinit, 22 FOCUS_MODE, 22 FOCUS_MODE_AUTO, 22 FOCUS_MODE_FIXED, 22 FOCUS_MODE_INFINITY, 22 FOCUS_MODE_MACRO, 22 getCameraCalibration, 23 getInstance, 22 getNumVideoModes, 23

getVideoMode, 23 init, 22 MODE, 22 MODE_DEFAULT, 22 MODE_OPTIMIZE_QUALITY, 22 MODE_OPTIMIZE_SPEED, 22 selectVideoMode, 23 setFlashTorchMode, 23 setFocusMode, 23 start, 22 startAutoFocus, 23 stop, 22 stopAutoFocus, 23 QCAR::DataSet, 25 ~DataSet, 26 createMultiTarget, 27 destroy, 27 exists, 26 getNumTrackables, 26 getTrackable, 26 load, 26 STORAGE_ABSOLUTE, 26 STORAGE_APP, 26 STORAGE_APPRESOURCE, 26 STORAGE_TYPE, 26 QCAR::Frame, 28 ~Frame, 28 Frame, 28 getImage, 29 getIndex, 29 getNumImages, 29 getTimeStamp, 29 mData, 29 operator=, 29 QCAR::Image, 30 getBufferHeight, 31 getBufferWidth, 31 getFormat, 31 getHeight, 31 getPixels, 31 getStride, 31 getWidth, 30 QCAR::ImageTarget, 32 createVirtualButton, 33 destroyVirtualButton, 33 getNumVirtualButtons, 33 getSize, 33 getVirtualButton, 33 setSize, 33 QCAR::ImageTracker, 35 activateDataSet, 36 createDataSet, 35 deactivateDataSet, 36 destroyDataSet, 35 getActiveDataSet, 36 QCAR::Marker, 37 getMarkerId, 38 getMarkerType, 38 getSize, 38 ID_FRAME, 37

Appendix - 108

QCAR SDK v1.5 Beta1 Public API Documentation

INVALID, 37 setSize, 38 TYPE, 37 QCAR::MarkerTracker, 39 createFrameMarker, 39 destroyMarker, 40 getMarker, 40 getNumMarkers, 40 QCAR::Matrix34F, 41 data, 41 QCAR::Matrix44F, 42 data, 42 QCAR::MultiTarget, 43 addPart, 44 getNumParts, 44 getPart, 44 getPartOffset, 45 removePart, 44 setPartOffset, 44 QCAR::NonCopyable, 46 ~NonCopyable, 46 NonCopyable, 46 QCAR::Rectangle, 50 ~Rectangle, 51 bottom, 51 getAreaSize, 51 getHeight, 51 getLeftTopX, 51 getLeftTopY, 51 getRightBottomX, 51 getRightBottomY, 51 getType, 51 getWidth, 51 left, 51 operator=, 51 Rectangle, 51 right, 51 top, 51 QCAR::Renderer, 52 begin, 53 bindVideoBackground, 53 drawVideoBackground, 53 end, 53 getInstance, 52 getVideoBackgroundConfig, 53 getVideoBackgroundTextureInfo, 53 setARProjection, 53 setVideoBackgroundConfig, 53 setVideoBackgroundTextureID, 53 QCAR::State, 54 ~State, 55 getActiveTrackable, 55 getFrame, 55 getNumActiveTrackables, 55 getNumTrackables, 55 getTrackable, 55 mData, 55 operator=, 55 State, 54, 55 QCAR::Tool, 15

convertPose2GLMatrix, 15 getProjectionGL, 15 multiply, 16 multiplyGL, 16 projectPoint, 15 setRotation, 16 setTranslation, 16 QCAR::Trackable, 56 ~Trackable, 57 DETECTED, 57 getId, 57 getName, 58 getPose, 58 getStatus, 57 getType, 57 IMAGE_TARGET, 57 isOfType, 57 MARKER, 57 MULTI_TARGET, 57 NOT_FOUND, 57 STATUS, 57 TRACKED, 57 TYPE, 57 UNDEFINED, 57 UNKNOWN, 57 UNKNOWN_TYPE, 57 QCAR::Tracker, 59 ~Tracker, 60 getType, 60 IMAGE_TRACKER, 59 MARKER_TRACKER, 59 start, 60 stop, 60 TYPE, 59 QCAR::TrackerManager, 61 deinitTracker, 61 getInstance, 61 getTracker, 61 initTracker, 61 QCAR::UpdateCallback, 63 QCAR_onUpdate, 63 QCAR::Vec2F, 64 data, 64 Vec2F, 64 QCAR::Vec2I, 65 data, 65 Vec2I, 65 QCAR::Vec3F, 66 data, 66 Vec3F, 66 QCAR::Vec3I, 67 data, 67 Vec3I, 67 QCAR::Vec4F, 68 data, 68 Vec4F, 68 QCAR::Vec4I, 69 data, 69 Vec4I, 69 QCAR::VideoBackgroundConfig, 70

Appendix - 109

QCAR SDK v1.5 Beta1 Public API Documentation

mEnabled, 70 mPosition, 70 mSize, 70 mSynchronous, 70 QCAR::VideoBackgroundTextureInfo, 71 mImageSize, 71 mPixelFormat, 71 mTextureSize, 71 QCAR::VideoMode, 72 mFramerate, 72 mHeight, 72 mWidth, 72 VideoMode, 72 QCAR::VirtualButton, 73 getArea, 74 getID, 74 getName, 74 HIGH, 73 isEnabled, 74 isPressed, 74 LOW, 74 MEDIUM, 74 SENSITIVITY, 73 setArea, 74 setEnabled, 74 setSensitivity, 74 QCAR_API System.h, 94 QCAR_onUpdate QCAR::UpdateCallback, 63 Rectangle QCAR::Rectangle, 51 RECTANGLE QCAR::Area, 17 Rectangle.h, 91 registerCallback QCAR, 13 removePart QCAR::MultiTarget, 44 Renderer.h, 92 requiresAlpha com::qualcomm::QCAR::QCAR, 48 QCAR, 13 RGB565 QCAR, 12 RGB888 QCAR, 12 right QCAR::Rectangle, 51 selectVideoMode QCAR::CameraDevice, 23 SENSITIVITY QCAR::VirtualButton, 73 setArea QCAR::VirtualButton, 74 setARProjection QCAR::Renderer, 53 setEnabled QCAR::VirtualButton, 74 setFlashTorchMode

QCAR::CameraDevice, 23 setFocusMode QCAR::CameraDevice, 23 setFrameFormat QCAR, 13 setHint QCAR, 12 setInitParameters com::qualcomm::QCAR::QCAR, 48 QCAR, 13 setPartOffset QCAR::MultiTarget, 44 setRotation QCAR::Tool, 16 setSensitivity QCAR::VirtualButton, 74 setSize QCAR::ImageTarget, 33 QCAR::Marker, 38 setTranslation QCAR::Tool, 16 setVideoBackgroundConfig QCAR::Renderer, 53 setVideoBackgroundTextureID QCAR::Renderer, 53 start QCAR::CameraDevice, 22 QCAR::Tracker, 60 startAutoFocus QCAR::CameraDevice, 23 State QCAR::State, 54, 55 State.h, 93 STATUS QCAR::Trackable, 57 stop QCAR::CameraDevice, 22 QCAR::Tracker, 60 stopAutoFocus QCAR::CameraDevice, 23 STORAGE_ABSOLUTE QCAR::DataSet, 26 STORAGE_APP QCAR::DataSet, 26 STORAGE_APPRESOURCE QCAR::DataSet, 26 STORAGE_TYPE QCAR::DataSet, 26 System.h, 94 QCAR_API, 94 Tool.h, 95 top QCAR::Rectangle, 51 Trackable.h, 96 TRACKED QCAR::Trackable, 57 Tracker.h, 97 TrackerManager.h, 98 TYPE QCAR::Area, 17

Appendix - 110

QCAR SDK v1.5 Beta1 Public API Documentation

QCAR::Marker, 37 QCAR::Trackable, 57 QCAR::Tracker, 59 UNDEFINED QCAR::Trackable, 57 UNKNOWN QCAR::Trackable, 57 UNKNOWN_FORMAT QCAR, 12 UNKNOWN_TYPE QCAR::Trackable, 57 UpdateCallback.h, 99 Vec2F QCAR::Vec2F, 64 Vec2I QCAR::Vec2I, 65 Vec3F

QCAR::Vec3F, 66 Vec3I QCAR::Vec3I, 67 Vec4F QCAR::Vec4F, 68 Vec4I QCAR::Vec4I, 69 Vectors.h, 100 VideoBackgroundConfig.h, 101 VideoBackgroundTextureInfo.h, 102 VideoMode QCAR::VideoMode, 72 VideoMode.h, 103 VirtualButton.h, 104 YUV QCAR, 12

NOTE: Page numbers are with reference to Appendix.

Appendix - 111

S-ar putea să vă placă și