Tutorial on OpenCV for Android Setup



Similar documents
Tutorial on Basic Android Setup

Basic Android Setup Windows Version

Tutorial on Basic Android Setup

OpenCV on Android Platforms

Android and OpenCV Tutorial

Development_Setting. Step I: Create an Android Project

Introduction to Android Development

Native code in Android Quad Detection

Android Programming. Høgskolen i Telemark Telemark University College. Cuong Nguyen,

Hello World. by Elliot Khazon

Android Environment SDK

Installing the Android SDK

Android Application Development

The "Eclipse Classic" version is recommended. Otherwise, a Java or RCP version of Eclipse is recommended.

Android Development Setup [Revision Date: 02/16/11]

Download and Installation Instructions. Android SDK and Android Development Tools (ADT) Microsoft Windows

Board also Supports MicroBridge

How To Run A Hello World On Android (Jdk) On A Microsoft Ds.Io (Windows) Or Android Or Android On A Pc Or Android 4 (

Intel Integrated Native Developer Experience (INDE): IDE Integration for Android*

Qualcomm IR-I 2 C Bridge Demo

Google App Engine f r o r J av a a v a (G ( AE A / E J / )

System Reference 2013

Introduction to Gear VR Development in Unity APPENDIX A: SETUP (WINDOWS 7/8)

Installing Eclipse C++ for Windows

Java with Eclipse: Setup & Getting Started

Develop a Hello World project in Android Studio Capture, process, store, and display an image. Other sensors on Android phones

Android: Setup Hello, World: Android Edition. due by noon ET on Wed 2/22. Ingredients.

Setting up Sudoku example on Android Studio

Android Environment SDK

IOIO for Android Beginners Guide Introduction

NVIDIA Tegra Android Platform Support Pack Getting Started Guide

Eclipse installation, configuration and operation

Example Connection between USB Host and Android

Islamic University of Gaza. Faculty of Engineering. Computer Engineering Department. Mobile Computing ECOM Eng. Wafaa Audah.

Advertiser Campaign SDK Your How-to Guide

Home Course Catalog Schedule Pricing & Savings Training Options Resources About Us

Android Development. 吳 俊 興 國 立 高 雄 大 學 資 訊 工 程 學 系

MS Visual C++ Introduction. Quick Introduction. A1 Visual C++

Download and Installation Instructions. Android SDK and Android Development Tools (ADT)

WA2102 Web Application Programming with Java EE 6 - WebSphere RAD 8.5. Classroom Setup Guide. Web Age Solutions Inc. Web Age Solutions Inc.

How to Create an Android Application using Eclipse on Windows 7

ID TECH UniMag Android SDK User Manual

Using Microsoft Visual Studio API Reference

Tutorial: BlackBerry Object API Application Development. Sybase Unwired Platform 2.2 SP04

Developing In Eclipse, with ADT

Creating a 2D Game Engine for Android OS. Introduction

Building graphic-rich and better performing native applications. Pro. Android C++ with the NDK. Onur Cinar

How to use the Eclipse IDE for Java Application Development

Advantages. manage port forwarding, set breakpoints, and view thread and process information directly

Getting Started with Android Development

How to Install Eclipse. Windows

Tutorial: Android Object API Application Development. SAP Mobile Platform 2.3 SP02

Document Management Quick Reference Guide

Fahim Uddin 1. Java SDK

Crystal Reports for Eclipse

CS 528 Mobile and Ubiquitous Computing Lecture 2: Android Introduction and Setup. Emmanuel Agu

Samples and tutorials Version Hiring Sample Tutorial for IBM Process Designer

TUTORIAL ECLIPSE CLASSIC VERSION: ON SETTING UP OPENERP 6.1 SOURCE CODE UNDER WINDOWS PLATFORM. by Pir Khurram Rashdi

POOSL IDE Installation Manual

Tutorial: setting up a web application

SIM900 Eclipse environment install Application Note_V1.00

Drobo How-To Guide Drobo Apps - Configuring ElephantDrive

Installing (1.8.7) 9/2/ Installing jgrasp

With a single download, the ADT Bundle includes everything you need to begin developing apps:

Informatics for Integrating Biology & the Bedside. i2b2 Workbench Developer s Guide. Document Version: 1.0 i2b2 Software Release: 1.3.

Developing an Application on Core8051s IP-Based Embedded Processor System Using Firmware Catalog Drivers. User s Guide

Introduction to Android Programming (CS5248 Fall 2015)

Tutorial: Mobile Business Object Development. SAP Mobile Platform 2.3 SP02

01. Introduction of Android

Supplement I.B: Installing and Configuring JDK 1.6

Lab 0 (Setting up your Development Environment) Week 1

Tutorial: Android Object API Application Development. SAP Mobile Platform 2.3

WA1826 Designing Cloud Computing Solutions. Classroom Setup Guide. Web Age Solutions Inc. Copyright Web Age Solutions Inc. 1

Oracle FLEXCUBE Direct Banking Android Tab Client Installation Guide Release

IBM TRIRIGA Anywhere Version 10 Release 4. Installing a development environment

Android Programming: Installation, Setup, and Getting Started

Android Development Tutorial. Nikhil Yadav CSE40816/ Pervasive Health Fall 2011

About this Release. Introduction. Prerequisites. Installation. Using the Web SDK Packager

APPLICATION NOTE. Getting Started with pylon and OpenCV

Tutorial: Mobile Business Object Development. Sybase Unwired Platform 2.2 SP02

Introduction to Gear VR Development in Unity APPENDIX A: SETUP (MAC OS X)

Tutorial: Mobile Business Object Development. SAP Mobile Platform 2.3

Microsoft Tag Scanning SDK for iphone & Android Apps

Android: How To. Thanks. Aman Nijhawan

Android Setup Phase 2

Sabre Red Workspace Basic Installation User Guide Version 2.0

1) SETUP ANDROID STUDIO

Setting Up Your Android Development Environment. For Mac OS X (10.6.8) v1.0. By GoNorthWest. 3 April 2012

Oculus Mobile Software Development Kit (SDK) Device and Environment Setup Guide

Beginning with SubclipseSVN

Eclipse with Mac OSX Getting Started Selecting Your Workspace. Creating a Project.

Android Development Tools for Eclipse

Accessing the Online Meeting Room (Blackboard Collaborate)

Android Introduction

Homework 9 Android App for Weather Forecast

Overview of Web Services API

Developing NFC Applications on the Android Platform. The Definitive Resource

Transcription:

Tutorial on OpenCV for Android Setup EE368/CS232 Digital Image Processing, Spring 2015 Macintosh Version For personal Android devices (advised: Android 3.0 or higher) Introduction In this tutorial, we will learn how to install OpenCV for Android on your computer and how to build Android applications using OpenCV functions. First, we will explain how to download and install the OpenCV library onto your computer. Second, we will explain how to build applications that directly call OpenCV functions on the viewfinder frames of the Android device, as shown in Figure 1. Figure 1. Android application drawing face detections on a viewfinder frame. Please note that this tutorial assumes that you have successfully completed the first Android tutorial for EE368/CS232, Tutorial on Basic Android Setup, which explains how to install the Android SDK and the Eclipse IDE. You will need to have already installed all the software tools mentioned in that other tutorial before moving onto this tutorial. Estimated time to complete this tutorial: 1.5 hours 1

Part I: Installing OpenCV for Android 1 Downloading and Installing Android NDK The Android NDK enables us to compile and run native C/C++ code on Android. 1. Download the latest version of the NDK from this website: http://developer.android.com/tools/sdk/ndk/index.html 2. Move the package to a location without spaces in the path, for example: /Users/YourName/Android/ and execute it (cf. link above). 3. Define NDKROOT as a new environment variable pointing to the unzipped location from the last step. In Eclipse, select Eclipse > Preferences > C/C++ > Build > Environment. Add a new variable with name NDKROOT and value set to the NDK installation path. Downloading and Installing OpenCV SDK for Android Now, we are ready to download and install the OpenCV SDK. 1. Download the latest version of the SDK (e.g. 2.4.11) from this website: http://sourceforge.net/projects/opencvlibrary/files/opencv-android/ 2. Unzip the downloaded file to a location without spaces in the path, for example: /Users/YourName/Android/OpenCV-android-sdk 3. It is advised to start from a clean Eclipse workspace. This is the case if you have followed this tutorial up to this point. In Eclipse, select File > Import > General > Existing Projects into Workspace. Select Specify root directory and input the location where the SDK contents were unzipped, for example: /Users/YourName/Android/OpenCV-android-sdk 4. After seeing the OpenCV library and sample projects appear in the Projects box, click Finish. It may take a minute for all the projects to be loaded and initialized. Thereafter, you have the projects imported into the workspace, as shown in Figure 2. 5. For each project imported, right click and choose Properties. In the Android tab, make sure that a build target is checked and press OK. After cleaning the workspace and rebuilding it, most projects should build without error. 6. For the projects that still show errors, click Project > Properties > C/C++ Build and change ${NDKROOT}/ndk_build.cmd to ${NDKROOT}/ndk_build. All the projects should compile without error at this point. 1 Parts of this tutorial borrow explanations from the OpenCV website (http://opencv.org/platforms/android.html). 2

Figure 2. OpenCV library and sample projects loaded into Eclipse workspace. Part II: Running OpenCV Sample Applications Running OpenCV Samples 1. Connect your device to your computer via USB. 2. In Eclipse, click on any of the sample OpenCV projects. Then, click Run > Run As > Android Application. You can monitor the installation status in the Console. On the first launch, you will most likely be prompted to install the OpenCV Manager app onto your device, which you need to do. 3. Try different samples. For example, if we run OpenCV Sample face-detection project, we can see real-time face detections like in Figure 1 displayed on the mobile device. 4. Alternatively, we can add some code to the OpenCV Tutorial 2 Mixed Processing project, we can see a locally adaptive binarization of some text document like in Figure 3 displayed on the mobile device. a. Open Tutorial2Activity.java, which is the main Java source file. b. At the top of the file, add: private static final int VIEW_MODE_THRESH = 3; private MenuItem mitempreviewthresh; 3

c. In the method oncreateoptionsmenu, add: mitempreviewthresh = menu.add( Thresh. ); d. In the method oncameraframe, add: case VIEW_MODE_THRESH: mrgba = inputframe.rgba(); int maxvalue = 255; int blocksize = 61; int meanoffset = 15; Imgproc.adaptiveThreshold( inputframe.gray(), mintermediatemat, maxvalue, Imgproc.ADAPTIVE_THRESH_MEAN_C, Imgproc.THRESH_BINARY_INV, blocksize, meanoffset ); Imgproc.cvtColor( mintermediatemat, mrgba, Imgproc.COLOR_GRAY2RGBA, 4 ); e. In the method onoptionsitemselected, add: else if (item == mitempreviewthresh) { mviewmode = VIEW_MODE_THRESH; } 5. We can look further at the source code of the sample OpenCV projects. All of them have a similar structure: (i) code for initializing the camera, (ii) code for processing and augmenting the viewfinder frames, and (iii) code for regulating the Android activity transitions. 6. We can also examine the OpenCV Library 2.4.11 project, which contains the JNI interfaces to the OpenCV library functions. The function interfaces are essentially identical to those listed in the official documentation here: http://docs.opencv.org/ 4

Figure 3. Android application showing adaptive binarization of a viewfinder frame. 5