Designing visionary mobile apps using Tegra Android Development Pack -

Designing visionary mobile apps using Tegra Android Development Pack


Editor’s Note: In this Product How-To development article, Shalini Gupta explans how to use the NVIDIA’s Tegra Android Development Pack to develop embedded vision applications based on the open source OpenCV tool suite.

NVIDIA makes life easier for Android developers by providing all of the software tools needed to develop for Android on NVIDIA’s Tegra platform in a single easy-to-install TADP (Tegra Android Development Pack ). The TADP is available for Windows, Mac OS X, Ubuntu Linux 32-bit and Ubuntu Linux 64-bit. It is targeted for Tegra devices, but will set up your development environment for any Android device.

You can obtain the TADP by registering on NVIDIA’s Developer Zone website and by applying for the Tegra Registered Developer Program . Once approved, typically within 48 hours, you’ll be able to access the TADP by logging into your NVIDIA Developer Zone account and by following the links to DEVELOPER CENTERS > Mobile > TEGRA ANDROID DEVELOPMENT PACK.

Every 1-2 months, Nvidia publishes incremental updates to the TADP containing newer versions of its components. Major updates are published about once a year. These updates may contain a completely restructured package with new components.

OpenCV for Tegra
Beginning with TADP 2.0, NVIDIA provides a software development kit (SDK) for OpenCV for Tegra . OpenCV for Tegra is a fully compatible, optimized backend implementation of OpenCV for Android, which runs 2-20x faster on Tegra 3-based devices.

The OpenCV for Tegra SDK in the TADP contains:

  • OpenCV for Tegra libraries in binary form
  • Pre-configured Android Eclipse example projects for OpenCV for Tegra
  • Step-by-step documentation on How to Use OpenCV for Tegra, including details of its functionality, and
  • An OpenCV for Tegra Demo App , which demonstrates the optimization that can be achieved with OpenCV for Tegra vs. the un-optimized OpenCV for Android library on Tegra 3-based devices .

The OpenCV for Tegra library is packaged into a single Android Application Package (OpenCV_2.4.2_binary_pack_tegra3.apk) located in the OpenCV-2.4.2-Tegra-sdk/apk/ folder of the TADP installation directory. You can also download this .apk , free of cost, from the Google Play store. Once installed, the OpenCV for Tegra libraries are ready to be dynamically linked into your Android applications.

If your application uses the OpenCV Manager service, it will automatically search for and load the OpenCV for Tegra library on your Tegra 3-based device at run time. If the OpenCV for Tegra library is absent on your device, its .apk will either be downloaded automatically from the Google Play store, or, if the latter is inaccessible, the user will be prompted to install the .apk manually.

Alternatively, the native (C/C++) versions of OpenCV for Tegra libraries are also availablein binary form in the OpenCV-2.4.2-Tegra-sdk/sdk/native/libs/tegra3 folder of your TADP installation directory. You can link them statically into the native part of your Android applications by appropriately including the path to the file in your application’s file:


include ../../sdk/native/jni/

By default, all the Eclipse OpenCV examples in the TADP comepre-configured to use the OpenCV for Tegra libraries (via static ordynamic linking). Note that if the Tegra optimized libraries arestatically linked in, they are not guaranteed to run on non-Tegra3-based device. Hence, it is advisable to always use dynamic linking viathe OpenCV Manager service in your published apps to ensure theircompatibility on different hardware platforms.

To determinewhether the Tegra optimized functions are indeed being used in yourapplication, check for the presence of the following message in theAndroid systems logs. You can use the adb logcat command to write outthe system logs.

E/OpenCV_for_Tegra(28465): Tegra platform detected, optimizations are switched ON!

Additionally, the OpenCV Manager installed on your device will display the information about your detected Tegra hardware (Figure 1 ).

Click on image to enlarge.

Figure 1: The OpenCV Manager displays information about your detected Tegra hardware

Tocheck out the speedups you can get with the OpenCV for Tegra, downloadand run the OpenCV for Tegra Demo App. You can download it from GooglePlay or find its OpenCVBenchmark.apk in the OpenCV-2.4.2-Tegra-sdk/apk/folder of your TADP installation directory. The app continuously grabspreview frames from the camera, processes them in an asynchronousprocessing thread, and displays the processed frames.

Differentprocessing modes (medianBlur, GaussianBlur, etc.) can be selected fromthe menu options. OpenCV for Tegra optimizations can be turned on or offby touching on the NVIDIA logo on the lower right of the display. WhenTegra optimizations are enabled, the NVIDIA logo will turn green. Checkthe information displayed in the upper part of the display for yourhardware's performance statistics.

Shalini Gupta is aSenior Mobile Computer Vision Engineer at NVIDIA. Her previousexperience includes two years as an Imaging and Architecture Scientistat Texas Instruments, along with work at AT&T Laboratories andAdvanced Digital Imaging Research, LLC (where she developed successfulnovel algorithms for 3D facial recognition). Shalini obtained herBachelors Degree in Electronics and Electrical Communication Engineeringat Punjab Engineering College, and her Masters Degree and Ph.D. inElectrical and Computer Engineering at the University of Texas atAustin.

Leave a Reply

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