OpenCV on Android Platforms



Similar documents
Android Environment SDK

Android Environment SDK

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

Programming with Android: SDK install and initial setup. Dipartimento di Informatica: Scienza e Ingegneria Università di Bologna

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

Android Programming and Security

Fahim Uddin 1. Java SDK

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

How To Develop Android On Your Computer Or Tablet Or Phone

Android Development. Marc Mc Loughlin

Programming with Android: SDK install and initial setup. Dipartimento di Informatica: Scienza e Ingegneria Università di Bologna

Jordan Jozwiak November 13, 2011

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

Tutorial on OpenCV for Android Setup

Mobile Application Development

Android: How To. Thanks. Aman Nijhawan

Specialized Android APP Development Program with Java (SAADPJ) Duration 2 months

Android Setup Phase 2

Lab 0 (Setting up your Development Environment) Week 1

How To Develop An Android App On An Android Device

An Introduction to Android

l What is Android? l Getting Started l The Emulator l Hello World l ADB l Text to Speech l Other APIs (camera, bitmap, etc)

Android Mobile App Building Tutorial

Development_Setting. Step I: Create an Android Project

Android Development. Lecture AD 0 Android SDK & Development Environment. Università degli Studi di Parma. Mobile Application Development

System Reference 2013

Smartphone market share

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

Tutorial on Basic Android Setup

Università Degli Studi di Parma. Distributed Systems Group. Android Development. Lecture 1 Android SDK & Development Environment. Marco Picone

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

How to Create an Android Application using Eclipse on Windows 7

Installing the Android SDK

Native code in Android Quad Detection

01. Introduction of Android

Getting Started with Android Development

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

RTI Connext DDS. Core Libraries Getting Started Guide Addendum for Android Systems Version 5.2.0

directory to "d:\myproject\android". Hereafter, I shall denote the android installed directory as

Reminders. Lab opens from today. Many students want to use the extra I/O pins on

Android Development Tools for Eclipse

Developing In Eclipse, with ADT

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

Introduction to Android Development

Android Application Development

Introduction to Android

Android Tutorial. Larry Walters OOSE Fall 2011

Developing NFC Applications on the Android Platform. The Definitive Resource

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

Introduction to Android Programming (CS5248 Fall 2015)

Introduction to Android Development. Jeff Avery CS349, Mar 2013

Chapter 2 Getting Started

Setting up Sudoku example on Android Studio

@ME (About) Marcelo Cyreno. Skype: marcelocyreno Linkedin: marcelocyreno Mail:

INTRODUCTION TO ANDROID CSCI 4448/5448: OBJECT-ORIENTED ANALYSIS & DESIGN LECTURE 11 02/15/2011

Introduction to Android

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

Basic Android Setup Windows Version

Developing for MSI Android Devices

Open Source Telemedicine Android Client Development Introduction

Table of Contents. Adding Build Targets to the SDK 8 The Android Developer Tools (ADT) Plug-in for Eclipse 9

Getting Started with Android Programming (5 days) with Android 4.3 Jelly Bean

Android Programming: Installation, Setup, and Getting Started

Oracle FLEXCUBE Direct Banking Android Tab Client Installation Guide Release

Getting Started: Creating a Simple App

Basics. Bruce Crawford Global Solutions Manager

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

IOIO for Android Beginners Guide Introduction

DEVELOPING MOBILE APPLICATIONS USING ANDROID

Introduction to Android. CSG250 Wireless Networks Fall, 2008

Application Development Setup Guide

ANDROID APPS DEVELOPMENT FOR MOBILE AND TABLET DEVICE (LEVEL I)

Creating a 2D Game Engine for Android OS. Introduction

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

App Development for Smart Devices. Lec #2: Android Tools, Building Applications, and Activities

AllJoyn Android Environment Setup Guide

Example Connection between USB Host and Android

NVIDIA Tegra Android Platform Support Pack Getting Started Guide

Advertiser Campaign SDK Your How-to Guide

Hello World. by Elliot Khazon

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

Graduate presentation for CSCI By Janakiram Vantipalli ( Janakiram.vantipalli@colorado.edu )

MMI 2: Mobile Human- Computer Interaction Android

ECWM511 MOBILE APPLICATION DEVELOPMENT Lecture 1: Introduction to Android

Android 4.4 App Development Essentials

Programming with Android

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

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 (

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

What else can you do with Android? Inside Android. Chris Simmonds. Embedded Linux Conference Europe Copyright 2010, 2net Limited.

Running a Program on an AVD

Android 5.0: Lollipop OS

Android, Bluetooth and MIAC

ADT Plugin for Eclipse

Developing Android Applications Introduction to Software Engineering Fall Updated 7 October 2015

J A D E T U TO R I A L

Transcription:

OpenCV on Android Platforms Marco Moltisanti Image Processing Lab http://iplab.dmi.unict.it moltisanti@dmi.unict.it http://www.dmi.unict.it/~moltisanti

Outline Intro System setup Write and build an Android app Write and build an OpenCV app for Android

A couple of words about Android / 1 Android is a Linux-based OS, oriented to mobile devices; Android, Inc. was founded in 2003 by Andy Rubin, Rich Miner, Nick Sears and Chris White; Google acquired Android, Inc. in 2005; In 2007, Open Handset Alliance, a consortium including Google, HW manufacturers and TC operators, unveiled Android as its first product, a mobile device platform. First commercial device running Android was HTC Dream, released on October, 2008.

A couple of words about Android / 2 Each major release is named after a dessert: first was Cupcake (1.5), current is Jelly Bean (4.1) Distribution of Android Releases: http://developer.android.com/about/dashboards/index.html

A couple of words about Android / 3 Applications for Android OS can be acquired through an app store, such as Google Play or the Amazon App Store; Moreover, it is possible download and install the app s APK file from a third party site.

Android Apps / 1 An Android app is packaged and distributed as an Android Package, i.e. a file with apk extension. All the code and data in a single apk file is considered a to be one application. Each app lives in a sandbox inside the Linuxbased Android OS. Each app has a unique ID and runs on its own Linux process. Each process has its own Virtual Machine.

Android Apps / 2 MyApp A single screen with a user interface Run in background Manage data Listen to system wide announcements

Android Apps: file Manifest The system must know the existence of the application s components. A «manifest» file, named AndroidManifest.xml, is needed in order to: Declare components; Identify user permissions (e.g. Internet Access); Declare minimum API level; Declare needed external lib;

Android Apps An exhaustive view of Application s architecture would take too much time Further informations available at http://developer.android.com/guide/components/index.html

Let s start! First of all, we need to setup our work environment. Developer s Kits, Virtual Machines, API,

Ingredients Java SDK 6 or higher Eclipse IDE A C/C++ Compiler (Visual C++ / MinGW / Cygwin) Android SDK Android NDK

Recipe / 1 Download and install Java SDK from http://www.oracle.com/technetwork/java/jav ase/downloads/jdk7u9-downloads- 1859576.html Let JAVA_FOLDER be the folder where we installed our JDK. Put the «JAVA_FOLDER\bin» directory in the System Path.

Recipe / 2 Download and install Android SDK from http://developer.android.com/sdk/index.html Download and unzip Android NDK from http://developer.android.com/tools/sdk/ndk/index.html

Recipe / 3 Download and unzip Eclipse IDE for Java Developers from http://www.eclipse.org/downloads/ Install the Android Development Tools (ADT) plugin for Eclipse: http://developer.android.com/sdk/installing/insta lling-adt.html Install the C/C++ Development Tooling (CDT) for Eclipse

Recipe / 4 A good quick start guide is available at http://docs.opencv.org/doc/tutorials/introduc tion/android_binary_package/android_dev_in tro.html

Android application structure Project root folder Jni C/C++ application source code Control the C++ build process Present if we need C/C++ code Android.mk and Application.mk Written with Makefile syntax Libs Compiled libs Res Resources of the application Images xml files describing UI layout Src Java code of the application AndroidManifest.xml essential information about application to the Android system: Name of the Application Name of main application s package Components of the application Required permissions default.properties text file containing information about target Android platform and other build details

Hello World! / 1 Click on the highlighted button (if you don t have it, you have to reinstall ADT plugin) to create a new Android App.

Hello World! / 2 Fill the form and click next. Go forward to the end of wizard we don t care in this moment about icons and stuff!

Hello World! / 3

Run, Hello World, run! / 1 To run our HelloWorld! App we have to setup a Virtual Device. This can be done using Android Virtual Device Manager, that comes with the SDK. Launch AVD Manager and create a new device

Run, Hello World, run! / 2 From Eclipse, click Run (CTRL+F11) and select the Android App modality Eclipse will launch the device emulator and run your app.

A bit deeper / 1 The user interface (UI) of an application is stored in a xml file, which contains each component s settings. The UI can be created modifying the xml or using the tools provided by Eclipse. Example!

A bit deeper / 2 The logic part is in a java file, with the same name of the activity we re working on. In our example, it s in MainActivity.java It is possible to access layout elements using the findviewbyid method. public View findviewbyid (int id) id can be retrieved using R.id.componentName

Events Handling Nobody likes a static UI! Here we use the Java event handling paradigm: Event Listeners! Each event has its own listener onclicklistener oncheckedchangelistener Few lines of code are better than a thousand words!

OpenCV for Android There are 3 ways to use OpenCV on Android 1. Basic level OpenCV Java API only + Android SDK. 2. Advanced level OpenCV native interface + Android NDK. 3. Hacker level We don't suggest this way. 1 & 2 use prebuilt OpenCV package: It allows to use both Java and C++ OpenCV API 3 needs OpenCV builded from sources.

Basic level OpenCV exposes almost all its functionality to Java including camera You don't even need to dive into NDK stuff You simply add a reference to the OpenCV, import its classes and move forward The overhead is equal to a cost of one or several JNI calls This approach works in many cases, but sometimes JNI calls can consume too much

Advanced level The Android way is writing all your code in Java Sometimes it is not enough and you need to go to a native level and write part of your application in C/C++: For example: you already have some computer functionality which is written in C++ but do not want to rewrite the C++ code to Java. Add a class with native methods and wrapping your C++ functionality into the Java part of your Android application C++ code of OpenCV is cross-platform, that means that you can port your desktop code to mobile devices

Hacker level We don't recommend this way, but it is useful if you want to work with OpenCV sources. Implement some new features Optimize the performance Submit a bugfix Want to have an access to the latest OpenCV features We won t try this approach!

Install OpenCV Manager on the VD / 1 Launch Android Virtual Device (AVD) Manager Start the Virtual Device

Install OpenCV Manager on the VD / 2 Let ANDROID_SDK be the folder where we installed the SDK; Let ANDROID_OPENCV be the folder where we put the opencv4android libs; Open a shell: cd ANDROID_SDK\platform_tools adb install ANDROID_OPENCV\apk\OpenCV_2.4.3_Manager_2.0_platform. apk Wait for success!

And now? String code = "Let s go to write down the code!"; System.out.prinltn(code);