Android and OpenCV Tutorial



Similar documents
Tutorial on OpenCV for Android Setup

Tutorial on Basic Android Setup

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

OpenCV on Android Platforms

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

Fahim Uddin 1. Java SDK

Android Environment SDK

Development_Setting. Step I: Create an Android Project

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

Example Connection between USB Host and Android

Android Setup Phase 2

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)

IOIO for Android Beginners Guide Introduction

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 (

System Reference 2013

Native code in Android Quad Detection

Basic Android Setup Windows Version

Android Environment SDK

TEGRA X1 DEVELOPER TOOLS SEBASTIEN DOMINE, SR. DIRECTOR SW ENGINEERING

Android Programming: Installation, Setup, and Getting Started

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

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

01. Introduction of Android

Android Development Tools for Eclipse

Using Microsoft Visual Studio API Reference

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.

Android Programming and Security

Installing the Android SDK

TouchTest TM Android Tutorial

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

Hello World. by Elliot Khazon

Introduction to Android Development

Running a Program on an AVD

ID TECH UniMag Android SDK User Manual

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

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

Getting Started with Android Development

Lab 0 (Setting up your Development Environment) Week 1

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

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

BUILDING MOBILE WEB APPS WITH PHONEGAP. Matt Zukowski

Android 4.4 App Development Essentials

How to Set Up Your PC for Android Application Development

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

More details >>> HERE <<<

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

Mobile Development Documentation

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

Android Development. Marc Mc Loughlin

NVIDIA Tegra Android Platform Support Pack Getting Started Guide

Developing Android Apps for BlackBerry 10. JAM854 Mike Zhou- Developer Evangelist, APAC Nov 30, 2012

Board also Supports MicroBridge

Adobe Summit 2015 Lab 712: Building Mobile Apps: A PhoneGap Enterprise Introduction for Developers

Title: Appium Automation for Mac OS X. Created By: Prithivirajan M. Abstract. Introduction

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

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

SAP Web IDE Hybrid App Toolkit Add-on

Developing In Eclipse, with ADT

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

Introduction: The Xcode templates are not available in Cordova or above, so we'll use the previous version, for this recipe.

ADT Plugin for Eclipse

Overview. The Android operating system is like a cake consisting of various layers.

ANDROID DEVELOPER TOOLS TRAINING GTC Sébastien Dominé, NVIDIA

Running Android Applications on BlackBerry 10 developer.blackberry.com/android

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

Setting up Sudoku example on Android Studio

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

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

Arduino & Android. A How to on interfacing these two devices. Bryant Tram

Getting Started with the Ed-Fi ODS and Ed-Fi ODS API

Android Hands-On Labs

Mobile Development Documentation

Robotium Automated Testing for Android

Generate Android App

Tutorial on Basic Android Setup

Tutorial on Client-Server Communications

Offline Android Installer

Software Development Kit for ios and Android

XenMobile Logs Collection Guide

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

How to Set Up Your PC for Android Application Development

file://d:\webs\touch-base.com\htdocs\documentation\androidplatformnotes52.htm

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

Android: How To. Thanks. Aman Nijhawan

Using MATLAB to Measure the Diameter of an Object within an Image

APPLICATION NOTE. Getting Started with pylon and OpenCV

Getting Started with the ZED 2 Introduction... 2

Qualcomm IR-I 2 C Bridge Demo

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

NaviCell Data Visualization Python API

Introduction to Android

Introduction to Android Programming (CS5248 Fall 2015)

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

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

AllJoyn Android Environment Setup Guide

EasyPush Push Notifications Extension for ios

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

Mobile Application Development

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

Transcription:

Android and OpenCV Tutorial Computer Vision Lab Tutorial 26 September 2013 Lorenz Meier, Amaël Delaunoy, Kalin Kolev Institute of Visual Computing

Tutorial Content Strengths / Weaknesses of Android Java vs Native Overview of available SDKs Complete example Assignment Project plan coaching Question session Institute of Visual Computing 2!

Android Software Development Kits Software Development Kit (SDK) Native Development Kit (NDK) Institute of Visual Computing 3!

Android Android 4.3 Jelly Bean Targeted compatibility version: 4.1 Android SDK: http://developer.android.com/ sdk/index.html Android NDK: http://developer.android.com/ tools/sdk/ndk/index.html Institute of Visual Computing 4!

Java SDK Easy to setup and get started Typically only mean of accessing the camera Slow for core vision algorithms Slow for some sensor access functions http://developer.android.com/ sdk/index.html Institute of Visual Computing 5!

Android NDK (C/C++, GNU/Linux API) Still easy enough to get started Offers full OpenCV functionality on the device Important: Have NDKROOT set as environment variable in Eclipse http://developer.android.com/tools/sdk/ndk/ index.html export PATH=/usr/local/bin:/usr/local/sbin:/Users/lomeier/android/android-ndk-r9:$PATH export NDKROOT=/Users/lomeier/android/android-ndk-r9" chmod u+x /Users/lomeier/android/android-ndk-r9/ndk-build.cmd" http://docs.opencv.org/doc/tutorials/introduction/android_binary_package/android_dev_intro.html! Institute of Visual Computing 6!

Computer Vision Toolkits for Android OpenCV Qualcomm Vuforia Qualcomm FastCV OpenVX Institute of Visual Computing 7!

OpenCV on Android Main reference http://opencv.org/platforms/android.html Watch out! API has changed, use only documentation and tutorials from 2012/2013 Start off with the OpenCV Tutorial #3: Native OpenCV http://docs.opencv.org/doc/tutorials/introduction/android_binary_package/android_dev_intro.html! Institute of Visual Computing 8!

Qualcomm Vuforia SDK Virtual Reality SDK for any Android / ios device https://developer.qualcomm.com/download http://www.youtube.com/watch?v=blf60qytrpi!! Institute of Visual Computing 9!

Qualcomm FastCV SDK Similar API to OpenCV Collection of low-level computer vision primitives On many functions faster than OpenCV https://developer.qualcomm.com/ mobile-development/mobiletechnologies/computer-vision-fastcv http://www.youtube.com/watch?v=ztxpfcpg-ga!! Institute of Visual Computing 10!

Preview: OpenVX the new standard SDK OpenGL equivalent for hardware-accelerated computer vision Co-developed with OpenCV All major industry players First draft end 2013 Institute of Visual Computing 11!

Android SDK + Android NDK + OpenCV Institute of Visual Computing 12!

Android SDK Installation Download from: http:// developer.android.com/ sdk/index.html Unzip the directory to a local directory without spaces in the path Institute of Visual Computing 13!

Android NDK Installation Download from: http:// developer.android.com/ tools/sdk/ndk/index.html Unzip to same top-level folder as the SDK Institute of Visual Computing 14!

OpenCV for Android Installation Download from: http://opencv.org/ downloads.html Unzip to same top-level folder as Android SDK and NDK Institute of Visual Computing 15!

Set up Eclipse / ADT Institute of Visual Computing 16!

Final directory layout After all SDKs are installed, the directory structure should look like similar to the screenshot below. Open the Eclipse folder and start the executable. Institute of Visual Computing 17!

Start Eclipse / ADT Institute of Visual Computing 18!

Start Android SDK Manager Institute of Visual Computing 19!

Install the Android Support Library Institute of Visual Computing 20!

Install the Android Support Library Institute of Visual Computing 21!

Android Project Setup Institute of Visual Computing 22!

Android Project Setup Right-click into the Eclipse project view Select Import.. Existing projects into workspace Select OpenCV Folder All tutorials will show up in the project list Right click the Tutorial #2 Institute of Visual Computing 23!

Import new project Institute of Visual Computing 24!

Institute of Visual Computing 25!

Institute of Visual Computing 26!

Institute of Visual Computing 27!

Institute of Visual Computing 28!

Project Properties Setup ENV variables Institute of Visual Computing 29!

Commandline Setup Imported Eclipse projects can contain errors and fail to compile dependencies Set up your command line environment by adding this to your ~/.bashrc or ~/.bash_profile file: export PATH=/usr/local/bin:/usr/local/sbin:/Users/lomeier/android/android-ndk-r8b:$PATH export NDKROOT=/Users/lomeier/android/android-ndk-r8b" source ~/.bash_profile" Make the ndk-build script executable chmod u+x /Users/lomeier/android/android-ndk-r9/ ndk-build.cmd" Institute of Visual Computing 30!

Commandline compilation Change to the folder to the project cd /Users/lomeier/src/android/OpenCV-2.4.6- android-sdk/samples/tutorial-3-native" Force a ndk clean build ndk-build -B" Build / upload now in Eclipse Institute of Visual Computing 31!

Launch Application Institute of Visual Computing 32!

Institute of Visual Computing 33!

Put Phone into developer mode Settings -> About phone Tap on build number Settings -> Developer options Enable USB debugging From: http://howto.cnet.com/8301-11310_39-57549207-285/restore-the-developer-options-menu-in-android-4.2/! Institute of Visual Computing 34!

Reset USB UNPLUG USB. RE-PLUG USB. CONFIRM THE USB CONNECTION. Institute of Visual Computing 35!

Select Cell Phone Institute of Visual Computing 36!

Troubleshooting Unsatisfied link error? Force a native build on the command line. cd /dir/to/opencv/samples" cd tutorial-2-mixedprocessing" ndk-build -B" Institute of Visual Computing 37!

Run the Sample (jni/jni_part.cpp) Standard example code extracts FAST corners " Mat& mgr = *(Mat*)addrGray;" Mat& mrgb = *(Mat*)addrRgba;" vector<keypoint> v;" FastFeatureDetector detector(50);" detector.detect(mgr, v);! for( unsigned int i = 0; i < v.size(); i++ )! {" const KeyPoint& kp = v[i];! circle(mrgb, Point(kp.pt.x, kp.pt.y), 10, Scalar(255,0,0,255));! }" Institute of Visual Computing 38!

Class Assignment (jni/jni_part.cpp) Extend sample to extract and match ORB features between two frames " Then color all pixels with ORB features translucent blue Mat& mgr = *(Mat*)addrGray; // This is the gray scale frame" Mat& mrgb = *(Mat*)addrRgba; // This is the frame in color" vector<keypoint> v; // You need to store the ones from the last frame " " " "// and this frame" OrbFeatureDetector detector(50);" detector.detect(mgr, v);! for( unsigned int i = 0; i < v.size(); i++ )! {" const KeyPoint& kp = v[i];! circle(mrgb, Point(kp.pt.x, kp.pt.y), 10, Scalar(0,0,255,100));!! line( from old point to new match)! }" OrbDescriptorExtractor " BruteForceMatcher<cv::HammingLUT> " Institute of Visual Computing 39!

Class Assignment Hand in until next Thursday (October 3, 2013) Screenshot (from device, not photos of display) Code from jni_part.cpp, inlined into email http:// www.howtogeek.com/ 121133/how-to-takescreenshots-on-androiddevices-since-4.0/ Institute of Visual Computing 40!

Camera Calibration Institute of Visual Computing 41!

Camera calibration Additional tutorial if required Pinhole camera model OpenCV functions available Undistortion and camera matrix map from image pixel locations to normalized camera coordinates ( rays ) Institute of Visual Computing 42!

Camera calibration 1. Find and match corners bool findchessboardcorners(image, patternsize, corners, flags); " double calibratecamera(objectpoints, imgpoints, imgsize, cammatrix, distcoeffs, rvecs, tvecs, flags, criteria); " 2. Calibrate camera (undistortion and rectification) 3. Optimize matrix 4. Test result on image Mat initcameramatrix2d(objpoints, imgpoints, imgsize, aspectratio); " void getoptimalnewcameramatrix(cammatrix, distcoeffs, imgsize, alpha, newimgsize, PixROI, cpp); " void undistort(src, dst, cameramatrix, distcoeffs, newcameramatrix); " " Institute of Visual Computing 43!

Project Plan and Management Institute of Visual Computing 44!

Project Proposal Q&A Papers / Scope Library choice Milestones Block Diagram Gantt Chart Institute of Visual Computing 45!

Diagrams in Report Data flow / block diagram Gantt Chart Institute of Visual Computing 46!

Project Management Use Github issue tracker and milestones http://github.com Use the Github for Windows / Mac OS app as GUI Simple GIT guide: http://rogerdudler.github.com/git-guide/ GIT SCM book: http://git-scm.com/book/ch1-3.html Institute of Visual Computing 47!