Android - How do I replace the DataSet in Image Targets sample

March 25, 2013 - 2:01am #1

The ImageTargets sample provided with the Vuforia SDK shows how to augment a few image targets using the StonesAndChips device database (DataSet).

If you wish to replace the sample dataset (StonesAndChips.xml) with your own , you can follow these steps:

  • login into the online Target Manager on the Vuforia developer web site (
  • create a Device Database with the name that you wish (for instance "MyImageTargets")
  • add one or more Image Targets to your Database, as explained here:
  • verify that the tracking rating (star rating) of your targets is sufficiently high (recommendation is to aim for a rating of at least 3 stars, although targets with 1 - 2 stars, despite being not ideal, can also work); for more information about the star rating and how to enhance it, please refer to these pages:
  • in your Device Database page, select the targets that you want to download with your database and then download your device database for the Android platform (this will be downloaded as a ZIP file)
  • unzip the downloaded database
  • copy the MyImageTargets.xml and MyImageTargets.dat files into the "assets/" directory of your Image Targets sample project 
  • Edit the source code in ImageTargets.cpp (under the /jni directory of your project), by setting the name of your dataset XML file in this line (replacing "StonesAndChips.xml" with "MyImageTargets.xml"):
if (!dataSetStonesAndChips->load("MyImageTargets.xml", QCAR::DataSet::STORAGE_APPRESOURCE))
        LOG("Failed to load data set.");
        return 0;
  • open a cygwin console and rebuild the native part of the project by running ndk-build
  • if the build is successfull (as it should), refresh the Java project in Eclipse (right-click on the project and click "Refresh" or press F5)
  • run the App on your device

Note: in case the sample app still detects the "chips" and "stones" targets and does not detect your targets, uninstall manually the ImageTargets sample App from your device and repeat the steps above.


Topic locked