SlideShare a Scribd company logo
1 of 19
OpenCV
      Image
      Processing
          on
      Android
      Devices

  Wilson Wingston Sharon
wingston.sharon@gmail.com
Le me
• Day job python developer.

• Hobby technologies

  o Machine Learning

  o Hardware Hacking

  o Image processing

  o Graphics & Video design
Introduction
• Open Computer Vision (OpenCV) developed &
  donated to FOSS by Intel.

• Open Source Image Processing library in C/C++

• Optimized for real time image / video processing
  applications

• OS/hardware independent with ports to Java,
  Python with wrappers to numerous other languages
  and platforms.
Why OpenCV?
• No need to reinvent the wheel to deal with image
  processing solutions.

• Has both high level and low level components.

• Lets you treat images as a 2D Matrix.
• Image processing comes down to simple mathematical
  operations on this Matrix.

• Also provides a framework for machine learning, 3D
  scene information, depth profile, object recognition,
  motion tracking etc..
Suiting up
• Sun JDK 6
   o Very important you DO NOT use Sun JDK 7. unless you want to deal with intermittent
     weird run time issues that make no sense. In that case go right ahead.


• Android SDK + NDK
   o Keep it updated once in a while.
   o Remember:You need “ia32-lib” if you’re running a 64 bit ubuntu/debian
   o NDK is required only if native code is erquired to be compiled.


• Android SDK tools rev14+
   o fun fact: using older versions can cause heartburn.


• SDK Platform API 8 is minimum required
   o But usually a device running 11 would have the processing power you need to play with
     image processing application without lag.


• Eclipse with ADT + CDT
   o Duh.
OpenCV4Android SDK
• Obtain CV-2.4.2-android-sdk.zip from sourceforge.
• SDK
   o Contains the openCV libraries and Java classes for Android.
   o /java, /native and /etc


• APK
   o Opencv manager apk that must be installed to make the openCV libaries on the
     android device available.
   o Android market installation can also be done.


• Samples
   o Contains a decent amount of openCV samples for android.
   o These samples are written as documentation.


   o See the openCV wiki for setting up Eclipse with OpenCV.
Overview of some
 openCV classes
   in /sdk/java
org.opencv.android

• Contains the Async loader that you’ll need
  to connect your application to the openCV
  libraries installed on your device.

• Utility function to convert between
  openCV data types and android ones.

• Some other loader classes for your
  viewing pleasure.
org.opencv.core

•Contains the core building blocks of openCV
•Matrix, point, rect and Bitmap data types
 defined here.

org.opencv.highgui

•Allows you to draw some GUI components
 on the screen.
•Also has the openCV videcapture class as an
 alternative to the android camera interface.
org.opencv.imgproc

• The main image processing functions exist here,
  like blurring edge detection, colour conversion.
• This file also contains documentation and usage
  of each function.

org.openCV.ml

• Contains classes to assist in developing almost
  any machine learning algorithm in images.
• Trees, statistical models, Bayes, Markov models, K
  nearest all provided here with in-code
  commented documentation
Programming
methodology
The application structure
• Best way (as suggested in samples) is as follows.

• MainActivity
   o Extends the android activity class & is the Launcher Activity.
   o Initializes the openCV libraries.
   o Handles the android activity lifecycle functions.

• opencvView
   o Extends opencvViewBase
   o Running openCV code goes here.

• opencvViewBase
   o Extends surfaceView as a holder for the video stream
   o Abstract class to simplify usage of OpenCV
   o Sets up and handles camera / preview & drawing
MainActivity.java
• onCreate()
   o This is called when the activity is first created.
   o OpenCVLoader.initAsync(…) attempts to start the openCV library and on
     completion calls mOpenCVCallBack.


• mOpenCVCallBack()
   o Inside there is a function called onManagerConnected() which checks to
     see if no errors were there
   o If openCV loaded sucessfully, then an instance of Sample1View can be
     created called say mView


• Also this class has the onPause(), onResume()
  functions which start / stop camera streaming as
  per the android activity lifecycle.
opencvView.java
• This class contains code relevant for your application, this
  directly extends the absract opencvViewBase class.

• processFrame(byte[] data)
   o Input comes in as byte[] data as raw camera feed

   o Using the mat.put() this picture can be stored in a matrix

   o Any openCV functions from imgproc etc.. can be performed on
     this mat object

   o Display must be in bitmap format, so the mat object is converted
     to bmp

   o This bmp object is returned to run() which displays it on the screen.
• Camera mCamera;
   o Camera object to open/close/ retrieve video information


• SurfaceHolder mHolder;
   o Holder to the surfaceview to enable a live streaming of video


• Mat mRgba;
   o Matrix Object that openCV uses for image manipulation


• Bitmap mBitmap;
   o Bitmap object that can be displayed on the surface view


• mRgba.put(0, 0, data);
   o Returns the raw data feed in an openCV matrix format.


• Imgproc.cvtColor(mGraySubmat, mRgba,
  Imgproc.COLOR_GRAY2RGBA, 4);
   o How to convert an RGB matrix to a greyscale


• Utils.matToBitmap(mRgba, bmp);
   o Converting a matrix to a bitmap
Real Time Applications
Real time Face detection
• fdActivity example is an openCV sample that shows how to
  implement face detection algorithm on a real time video
  stream.

• It is also an example on how to efficiently implement an
  algorithm in C and call it via the JNI interface.

• Also implements an FPS meter class to judge the usability of
  the algorithm used.

• A Haar Classifier from the ml library with the openCV trained
  xml file is used on the image stream to return if the image
  contains a face or not.

• It is the standard openCV way of face detetcion.
Possible Applications on
     android devices
• Obtain features from any image and send it over
  network for matching against an online database
  for object recognition.

• Use the front camera to monitor head movement
  and provide a hands free interface for some
  games.

• Auto-tagging of friends in photos taken and
  associating them with facebook/android contacts.
Thank You..

Any Questions?

wingston.sharon@gmail.com

More Related Content

What's hot

"The OpenCV Open Source Computer Vision Library: What’s New and What’s Coming...
"The OpenCV Open Source Computer Vision Library: What’s New and What’s Coming..."The OpenCV Open Source Computer Vision Library: What’s New and What’s Coming...
"The OpenCV Open Source Computer Vision Library: What’s New and What’s Coming...Edge AI and Vision Alliance
 
A high level introduction to OpenCV
A high level introduction to OpenCVA high level introduction to OpenCV
A high level introduction to OpenCVMax Tillich
 
"The OpenCV Open Source Computer Vision Library: Latest Developments," a Pres...
"The OpenCV Open Source Computer Vision Library: Latest Developments," a Pres..."The OpenCV Open Source Computer Vision Library: Latest Developments," a Pres...
"The OpenCV Open Source Computer Vision Library: Latest Developments," a Pres...Edge AI and Vision Alliance
 
PyCon 2012: Militarizing Your Backyard: Computer Vision and the Squirrel Hordes
PyCon 2012: Militarizing Your Backyard: Computer Vision and the Squirrel HordesPyCon 2012: Militarizing Your Backyard: Computer Vision and the Squirrel Hordes
PyCon 2012: Militarizing Your Backyard: Computer Vision and the Squirrel Hordeskgrandis
 
openCV with python
openCV with pythonopenCV with python
openCV with pythonWei-Wen Hsu
 
"OpenCV: Current Status and Future Plans," a Presentation from OpenCV.org
"OpenCV: Current Status and Future Plans," a Presentation from OpenCV.org"OpenCV: Current Status and Future Plans," a Presentation from OpenCV.org
"OpenCV: Current Status and Future Plans," a Presentation from OpenCV.orgEdge AI and Vision Alliance
 
Introduction to OpenCV 2.3.1
Introduction to OpenCV 2.3.1Introduction to OpenCV 2.3.1
Introduction to OpenCV 2.3.1Luigi De Russis
 
On technology transfer: experience from the CARP project... and beyond
On technology transfer: experience from the CARP project... and beyondOn technology transfer: experience from the CARP project... and beyond
On technology transfer: experience from the CARP project... and beyonddividiti
 

What's hot (11)

"The OpenCV Open Source Computer Vision Library: What’s New and What’s Coming...
"The OpenCV Open Source Computer Vision Library: What’s New and What’s Coming..."The OpenCV Open Source Computer Vision Library: What’s New and What’s Coming...
"The OpenCV Open Source Computer Vision Library: What’s New and What’s Coming...
 
A high level introduction to OpenCV
A high level introduction to OpenCVA high level introduction to OpenCV
A high level introduction to OpenCV
 
OpenCV Workshop
OpenCV WorkshopOpenCV Workshop
OpenCV Workshop
 
"The OpenCV Open Source Computer Vision Library: Latest Developments," a Pres...
"The OpenCV Open Source Computer Vision Library: Latest Developments," a Pres..."The OpenCV Open Source Computer Vision Library: Latest Developments," a Pres...
"The OpenCV Open Source Computer Vision Library: Latest Developments," a Pres...
 
PyCon 2012: Militarizing Your Backyard: Computer Vision and the Squirrel Hordes
PyCon 2012: Militarizing Your Backyard: Computer Vision and the Squirrel HordesPyCon 2012: Militarizing Your Backyard: Computer Vision and the Squirrel Hordes
PyCon 2012: Militarizing Your Backyard: Computer Vision and the Squirrel Hordes
 
Open Cv
Open CvOpen Cv
Open Cv
 
openCV with python
openCV with pythonopenCV with python
openCV with python
 
"OpenCV: Current Status and Future Plans," a Presentation from OpenCV.org
"OpenCV: Current Status and Future Plans," a Presentation from OpenCV.org"OpenCV: Current Status and Future Plans," a Presentation from OpenCV.org
"OpenCV: Current Status and Future Plans," a Presentation from OpenCV.org
 
Introduction to OpenCV 2.3.1
Introduction to OpenCV 2.3.1Introduction to OpenCV 2.3.1
Introduction to OpenCV 2.3.1
 
On technology transfer: experience from the CARP project... and beyond
On technology transfer: experience from the CARP project... and beyondOn technology transfer: experience from the CARP project... and beyond
On technology transfer: experience from the CARP project... and beyond
 
Unity 3 d-with-c
Unity 3 d-with-cUnity 3 d-with-c
Unity 3 d-with-c
 

Viewers also liked

Image Processing with OpenCV
Image Processing with OpenCVImage Processing with OpenCV
Image Processing with OpenCVdebayanin
 
Myro and OpenCV
Myro and OpenCVMyro and OpenCV
Myro and OpenCV2xrobert
 
RoboCV Module 4: Image Processing Techniques using OpenCV
RoboCV Module 4: Image Processing Techniques using OpenCVRoboCV Module 4: Image Processing Techniques using OpenCV
RoboCV Module 4: Image Processing Techniques using OpenCVroboVITics club
 
RoboCV Module 2: Introduction to OpenCV and MATLAB
RoboCV Module 2: Introduction to OpenCV and MATLABRoboCV Module 2: Introduction to OpenCV and MATLAB
RoboCV Module 2: Introduction to OpenCV and MATLABroboVITics club
 
Getting started with open cv in raspberry pi
Getting started with open cv in raspberry piGetting started with open cv in raspberry pi
Getting started with open cv in raspberry piJayaprakash Nagaruru
 
Using openCV on Raspberry Pi
Using openCV on Raspberry PiUsing openCV on Raspberry Pi
Using openCV on Raspberry PiCAVEDU Education
 
Arm cortex-m3 by-joe_bungo_arm
Arm cortex-m3 by-joe_bungo_armArm cortex-m3 by-joe_bungo_arm
Arm cortex-m3 by-joe_bungo_armPrashant Ahire
 
A basic introduction to open cv for image processing
A basic introduction to open cv for image processingA basic introduction to open cv for image processing
A basic introduction to open cv for image processingChu Lam
 
Radar 2009 a 15 parameter estimation and tracking part 1
Radar 2009 a 15 parameter estimation and tracking part 1Radar 2009 a 15 parameter estimation and tracking part 1
Radar 2009 a 15 parameter estimation and tracking part 1Forward2025
 
Projeto Jornal Escolar Wilson De Almeida
Projeto Jornal Escolar   Wilson De AlmeidaProjeto Jornal Escolar   Wilson De Almeida
Projeto Jornal Escolar Wilson De AlmeidaAna Claudia
 
Q4.11: ARM Architecture
Q4.11: ARM ArchitectureQ4.11: ARM Architecture
Q4.11: ARM ArchitectureLinaro
 

Viewers also liked (13)

Image Processing with OpenCV
Image Processing with OpenCVImage Processing with OpenCV
Image Processing with OpenCV
 
Myro and OpenCV
Myro and OpenCVMyro and OpenCV
Myro and OpenCV
 
RoboCV Module 4: Image Processing Techniques using OpenCV
RoboCV Module 4: Image Processing Techniques using OpenCVRoboCV Module 4: Image Processing Techniques using OpenCV
RoboCV Module 4: Image Processing Techniques using OpenCV
 
RoboCV Module 2: Introduction to OpenCV and MATLAB
RoboCV Module 2: Introduction to OpenCV and MATLABRoboCV Module 2: Introduction to OpenCV and MATLAB
RoboCV Module 2: Introduction to OpenCV and MATLAB
 
Getting started with open cv in raspberry pi
Getting started with open cv in raspberry piGetting started with open cv in raspberry pi
Getting started with open cv in raspberry pi
 
Using openCV on Raspberry Pi
Using openCV on Raspberry PiUsing openCV on Raspberry Pi
Using openCV on Raspberry Pi
 
Arm cortex-m3 by-joe_bungo_arm
Arm cortex-m3 by-joe_bungo_armArm cortex-m3 by-joe_bungo_arm
Arm cortex-m3 by-joe_bungo_arm
 
A basic introduction to open cv for image processing
A basic introduction to open cv for image processingA basic introduction to open cv for image processing
A basic introduction to open cv for image processing
 
OpenCV Introduction
OpenCV IntroductionOpenCV Introduction
OpenCV Introduction
 
Radar 2009 a 15 parameter estimation and tracking part 1
Radar 2009 a 15 parameter estimation and tracking part 1Radar 2009 a 15 parameter estimation and tracking part 1
Radar 2009 a 15 parameter estimation and tracking part 1
 
Projeto Jornal Escolar Wilson De Almeida
Projeto Jornal Escolar   Wilson De AlmeidaProjeto Jornal Escolar   Wilson De Almeida
Projeto Jornal Escolar Wilson De Almeida
 
ARM CORTEX M3 PPT
ARM CORTEX M3 PPTARM CORTEX M3 PPT
ARM CORTEX M3 PPT
 
Q4.11: ARM Architecture
Q4.11: ARM ArchitectureQ4.11: ARM Architecture
Q4.11: ARM Architecture
 

Similar to OpenCV @ Droidcon 2012

502021435-12345678Minor-Project-Ppt.pptx
502021435-12345678Minor-Project-Ppt.pptx502021435-12345678Minor-Project-Ppt.pptx
502021435-12345678Minor-Project-Ppt.pptxshrey4922
 
“OpenCV: Past, Present and Future,” a Presentation from OpenCV.org
“OpenCV: Past, Present and Future,” a Presentation from OpenCV.org“OpenCV: Past, Present and Future,” a Presentation from OpenCV.org
“OpenCV: Past, Present and Future,” a Presentation from OpenCV.orgEdge AI and Vision Alliance
 
Automatic License Plate Recognition using OpenCV
Automatic License Plate Recognition using OpenCVAutomatic License Plate Recognition using OpenCV
Automatic License Plate Recognition using OpenCVEditor IJCATR
 
Automatic License Plate Recognition using OpenCV
Automatic License Plate Recognition using OpenCV Automatic License Plate Recognition using OpenCV
Automatic License Plate Recognition using OpenCV Editor IJCATR
 
Implementation of embedded arm9 platform using qt and open cv for human upper...
Implementation of embedded arm9 platform using qt and open cv for human upper...Implementation of embedded arm9 platform using qt and open cv for human upper...
Implementation of embedded arm9 platform using qt and open cv for human upper...Krunal Patel
 
Starting with OpenCV on i.MX 6 Processors
Starting with OpenCV on i.MX 6 ProcessorsStarting with OpenCV on i.MX 6 Processors
Starting with OpenCV on i.MX 6 ProcessorsToradex
 
Image Detection and Count Using Open Computer Vision (Opencv)
Image Detection and Count Using Open Computer Vision (Opencv)Image Detection and Count Using Open Computer Vision (Opencv)
Image Detection and Count Using Open Computer Vision (Opencv)IJERA Editor
 
Everything you need to know about GraalVM Native Image
Everything you need to know about GraalVM Native ImageEverything you need to know about GraalVM Native Image
Everything you need to know about GraalVM Native ImageAlina Yurenko
 
Install, Compile, Setup, Setting OpenCV 3.2, Visual C++ 2015, Win 64bit,
Install, Compile, Setup, Setting OpenCV 3.2, Visual C++ 2015, Win 64bit, Install, Compile, Setup, Setting OpenCV 3.2, Visual C++ 2015, Win 64bit,
Install, Compile, Setup, Setting OpenCV 3.2, Visual C++ 2015, Win 64bit, Farshid Pirahansiah
 
Modern application development with oracle cloud sangam17
Modern application development with oracle cloud sangam17Modern application development with oracle cloud sangam17
Modern application development with oracle cloud sangam17Vinay Kumar
 
A Tutorial On Ip 2
A Tutorial On Ip 2A Tutorial On Ip 2
A Tutorial On Ip 2ankuredkie
 
How To Install OpenCV On Windows? Edureka
How To Install OpenCV On Windows? EdurekaHow To Install OpenCV On Windows? Edureka
How To Install OpenCV On Windows? EdurekaEdureka!
 
JDK Tools For Performance Diagnostics
JDK Tools For Performance DiagnosticsJDK Tools For Performance Diagnostics
JDK Tools For Performance DiagnosticsBaruch Sadogursky
 
Dynamic Languages in Production: Progress and Open Challenges
Dynamic Languages in Production: Progress and Open ChallengesDynamic Languages in Production: Progress and Open Challenges
Dynamic Languages in Production: Progress and Open Challengesbcantrill
 
Autonomous Machines with Project Bonsai
Autonomous Machines with Project BonsaiAutonomous Machines with Project Bonsai
Autonomous Machines with Project BonsaiIvo Andreev
 
Node.js Native AddOns from zero to hero - Nicola Del Gobbo - Codemotion Rome ...
Node.js Native AddOns from zero to hero - Nicola Del Gobbo - Codemotion Rome ...Node.js Native AddOns from zero to hero - Nicola Del Gobbo - Codemotion Rome ...
Node.js Native AddOns from zero to hero - Nicola Del Gobbo - Codemotion Rome ...Codemotion
 

Similar to OpenCV @ Droidcon 2012 (20)

502021435-12345678Minor-Project-Ppt.pptx
502021435-12345678Minor-Project-Ppt.pptx502021435-12345678Minor-Project-Ppt.pptx
502021435-12345678Minor-Project-Ppt.pptx
 
“OpenCV: Past, Present and Future,” a Presentation from OpenCV.org
“OpenCV: Past, Present and Future,” a Presentation from OpenCV.org“OpenCV: Past, Present and Future,” a Presentation from OpenCV.org
“OpenCV: Past, Present and Future,” a Presentation from OpenCV.org
 
OpenCV+Android.pptx
OpenCV+Android.pptxOpenCV+Android.pptx
OpenCV+Android.pptx
 
Automatic License Plate Recognition using OpenCV
Automatic License Plate Recognition using OpenCVAutomatic License Plate Recognition using OpenCV
Automatic License Plate Recognition using OpenCV
 
Automatic License Plate Recognition using OpenCV
Automatic License Plate Recognition using OpenCV Automatic License Plate Recognition using OpenCV
Automatic License Plate Recognition using OpenCV
 
Implementation of embedded arm9 platform using qt and open cv for human upper...
Implementation of embedded arm9 platform using qt and open cv for human upper...Implementation of embedded arm9 platform using qt and open cv for human upper...
Implementation of embedded arm9 platform using qt and open cv for human upper...
 
Starting with OpenCV on i.MX 6 Processors
Starting with OpenCV on i.MX 6 ProcessorsStarting with OpenCV on i.MX 6 Processors
Starting with OpenCV on i.MX 6 Processors
 
Image Detection and Count Using Open Computer Vision (Opencv)
Image Detection and Count Using Open Computer Vision (Opencv)Image Detection and Count Using Open Computer Vision (Opencv)
Image Detection and Count Using Open Computer Vision (Opencv)
 
Surge2012
Surge2012Surge2012
Surge2012
 
Everything you need to know about GraalVM Native Image
Everything you need to know about GraalVM Native ImageEverything you need to know about GraalVM Native Image
Everything you need to know about GraalVM Native Image
 
Opencv
OpencvOpencv
Opencv
 
Install, Compile, Setup, Setting OpenCV 3.2, Visual C++ 2015, Win 64bit,
Install, Compile, Setup, Setting OpenCV 3.2, Visual C++ 2015, Win 64bit, Install, Compile, Setup, Setting OpenCV 3.2, Visual C++ 2015, Win 64bit,
Install, Compile, Setup, Setting OpenCV 3.2, Visual C++ 2015, Win 64bit,
 
Java1 in mumbai
Java1 in mumbaiJava1 in mumbai
Java1 in mumbai
 
Modern application development with oracle cloud sangam17
Modern application development with oracle cloud sangam17Modern application development with oracle cloud sangam17
Modern application development with oracle cloud sangam17
 
A Tutorial On Ip 2
A Tutorial On Ip 2A Tutorial On Ip 2
A Tutorial On Ip 2
 
How To Install OpenCV On Windows? Edureka
How To Install OpenCV On Windows? EdurekaHow To Install OpenCV On Windows? Edureka
How To Install OpenCV On Windows? Edureka
 
JDK Tools For Performance Diagnostics
JDK Tools For Performance DiagnosticsJDK Tools For Performance Diagnostics
JDK Tools For Performance Diagnostics
 
Dynamic Languages in Production: Progress and Open Challenges
Dynamic Languages in Production: Progress and Open ChallengesDynamic Languages in Production: Progress and Open Challenges
Dynamic Languages in Production: Progress and Open Challenges
 
Autonomous Machines with Project Bonsai
Autonomous Machines with Project BonsaiAutonomous Machines with Project Bonsai
Autonomous Machines with Project Bonsai
 
Node.js Native AddOns from zero to hero - Nicola Del Gobbo - Codemotion Rome ...
Node.js Native AddOns from zero to hero - Nicola Del Gobbo - Codemotion Rome ...Node.js Native AddOns from zero to hero - Nicola Del Gobbo - Codemotion Rome ...
Node.js Native AddOns from zero to hero - Nicola Del Gobbo - Codemotion Rome ...
 

More from Wingston

05 content providers - Android
05   content providers - Android05   content providers - Android
05 content providers - AndroidWingston
 
04 activities - Android
04   activities - Android04   activities - Android
04 activities - AndroidWingston
 
03 layouts & ui design - Android
03   layouts & ui design - Android03   layouts & ui design - Android
03 layouts & ui design - AndroidWingston
 
02 hello world - Android
02   hello world - Android02   hello world - Android
02 hello world - AndroidWingston
 
01 introduction & setup - Android
01   introduction & setup - Android01   introduction & setup - Android
01 introduction & setup - AndroidWingston
 
C game programming - SDL
C game programming - SDLC game programming - SDL
C game programming - SDLWingston
 
C programming - Pointers
C programming - PointersC programming - Pointers
C programming - PointersWingston
 
Introduction to Basic C programming 02
Introduction to Basic C programming 02Introduction to Basic C programming 02
Introduction to Basic C programming 02Wingston
 
Introduction to Basic C programming 01
Introduction to Basic C programming 01Introduction to Basic C programming 01
Introduction to Basic C programming 01Wingston
 
Linux – an introduction
Linux – an introductionLinux – an introduction
Linux – an introductionWingston
 
Embedded linux
Embedded linuxEmbedded linux
Embedded linuxWingston
 
04 Arduino Peripheral Interfacing
04   Arduino Peripheral Interfacing04   Arduino Peripheral Interfacing
04 Arduino Peripheral InterfacingWingston
 
03 analogue anrduino fundamentals
03   analogue anrduino fundamentals03   analogue anrduino fundamentals
03 analogue anrduino fundamentalsWingston
 
02 General Purpose Input - Output on the Arduino
02   General Purpose Input -  Output on the Arduino02   General Purpose Input -  Output on the Arduino
02 General Purpose Input - Output on the ArduinoWingston
 
Introduction to the Arduino
Introduction to the ArduinoIntroduction to the Arduino
Introduction to the ArduinoWingston
 
4.content mgmt
4.content mgmt4.content mgmt
4.content mgmtWingston
 
8 Web Practices for Drupal
8  Web Practices for Drupal8  Web Practices for Drupal
8 Web Practices for DrupalWingston
 
7 Theming in Drupal
7 Theming in Drupal7 Theming in Drupal
7 Theming in DrupalWingston
 
6 Special Howtos for Drupal
6 Special Howtos for Drupal6 Special Howtos for Drupal
6 Special Howtos for DrupalWingston
 
5 User Mgmt in Drupal
5 User Mgmt in Drupal5 User Mgmt in Drupal
5 User Mgmt in DrupalWingston
 

More from Wingston (20)

05 content providers - Android
05   content providers - Android05   content providers - Android
05 content providers - Android
 
04 activities - Android
04   activities - Android04   activities - Android
04 activities - Android
 
03 layouts & ui design - Android
03   layouts & ui design - Android03   layouts & ui design - Android
03 layouts & ui design - Android
 
02 hello world - Android
02   hello world - Android02   hello world - Android
02 hello world - Android
 
01 introduction & setup - Android
01   introduction & setup - Android01   introduction & setup - Android
01 introduction & setup - Android
 
C game programming - SDL
C game programming - SDLC game programming - SDL
C game programming - SDL
 
C programming - Pointers
C programming - PointersC programming - Pointers
C programming - Pointers
 
Introduction to Basic C programming 02
Introduction to Basic C programming 02Introduction to Basic C programming 02
Introduction to Basic C programming 02
 
Introduction to Basic C programming 01
Introduction to Basic C programming 01Introduction to Basic C programming 01
Introduction to Basic C programming 01
 
Linux – an introduction
Linux – an introductionLinux – an introduction
Linux – an introduction
 
Embedded linux
Embedded linuxEmbedded linux
Embedded linux
 
04 Arduino Peripheral Interfacing
04   Arduino Peripheral Interfacing04   Arduino Peripheral Interfacing
04 Arduino Peripheral Interfacing
 
03 analogue anrduino fundamentals
03   analogue anrduino fundamentals03   analogue anrduino fundamentals
03 analogue anrduino fundamentals
 
02 General Purpose Input - Output on the Arduino
02   General Purpose Input -  Output on the Arduino02   General Purpose Input -  Output on the Arduino
02 General Purpose Input - Output on the Arduino
 
Introduction to the Arduino
Introduction to the ArduinoIntroduction to the Arduino
Introduction to the Arduino
 
4.content mgmt
4.content mgmt4.content mgmt
4.content mgmt
 
8 Web Practices for Drupal
8  Web Practices for Drupal8  Web Practices for Drupal
8 Web Practices for Drupal
 
7 Theming in Drupal
7 Theming in Drupal7 Theming in Drupal
7 Theming in Drupal
 
6 Special Howtos for Drupal
6 Special Howtos for Drupal6 Special Howtos for Drupal
6 Special Howtos for Drupal
 
5 User Mgmt in Drupal
5 User Mgmt in Drupal5 User Mgmt in Drupal
5 User Mgmt in Drupal
 

Recently uploaded

08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphNeo4j
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 

Recently uploaded (20)

08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 

OpenCV @ Droidcon 2012

  • 1. OpenCV Image Processing on Android Devices Wilson Wingston Sharon wingston.sharon@gmail.com
  • 2. Le me • Day job python developer. • Hobby technologies o Machine Learning o Hardware Hacking o Image processing o Graphics & Video design
  • 3. Introduction • Open Computer Vision (OpenCV) developed & donated to FOSS by Intel. • Open Source Image Processing library in C/C++ • Optimized for real time image / video processing applications • OS/hardware independent with ports to Java, Python with wrappers to numerous other languages and platforms.
  • 4. Why OpenCV? • No need to reinvent the wheel to deal with image processing solutions. • Has both high level and low level components. • Lets you treat images as a 2D Matrix. • Image processing comes down to simple mathematical operations on this Matrix. • Also provides a framework for machine learning, 3D scene information, depth profile, object recognition, motion tracking etc..
  • 5. Suiting up • Sun JDK 6 o Very important you DO NOT use Sun JDK 7. unless you want to deal with intermittent weird run time issues that make no sense. In that case go right ahead. • Android SDK + NDK o Keep it updated once in a while. o Remember:You need “ia32-lib” if you’re running a 64 bit ubuntu/debian o NDK is required only if native code is erquired to be compiled. • Android SDK tools rev14+ o fun fact: using older versions can cause heartburn. • SDK Platform API 8 is minimum required o But usually a device running 11 would have the processing power you need to play with image processing application without lag. • Eclipse with ADT + CDT o Duh.
  • 6. OpenCV4Android SDK • Obtain CV-2.4.2-android-sdk.zip from sourceforge. • SDK o Contains the openCV libraries and Java classes for Android. o /java, /native and /etc • APK o Opencv manager apk that must be installed to make the openCV libaries on the android device available. o Android market installation can also be done. • Samples o Contains a decent amount of openCV samples for android. o These samples are written as documentation. o See the openCV wiki for setting up Eclipse with OpenCV.
  • 7. Overview of some openCV classes in /sdk/java
  • 8. org.opencv.android • Contains the Async loader that you’ll need to connect your application to the openCV libraries installed on your device. • Utility function to convert between openCV data types and android ones. • Some other loader classes for your viewing pleasure.
  • 9. org.opencv.core •Contains the core building blocks of openCV •Matrix, point, rect and Bitmap data types defined here. org.opencv.highgui •Allows you to draw some GUI components on the screen. •Also has the openCV videcapture class as an alternative to the android camera interface.
  • 10. org.opencv.imgproc • The main image processing functions exist here, like blurring edge detection, colour conversion. • This file also contains documentation and usage of each function. org.openCV.ml • Contains classes to assist in developing almost any machine learning algorithm in images. • Trees, statistical models, Bayes, Markov models, K nearest all provided here with in-code commented documentation
  • 12. The application structure • Best way (as suggested in samples) is as follows. • MainActivity o Extends the android activity class & is the Launcher Activity. o Initializes the openCV libraries. o Handles the android activity lifecycle functions. • opencvView o Extends opencvViewBase o Running openCV code goes here. • opencvViewBase o Extends surfaceView as a holder for the video stream o Abstract class to simplify usage of OpenCV o Sets up and handles camera / preview & drawing
  • 13. MainActivity.java • onCreate() o This is called when the activity is first created. o OpenCVLoader.initAsync(…) attempts to start the openCV library and on completion calls mOpenCVCallBack. • mOpenCVCallBack() o Inside there is a function called onManagerConnected() which checks to see if no errors were there o If openCV loaded sucessfully, then an instance of Sample1View can be created called say mView • Also this class has the onPause(), onResume() functions which start / stop camera streaming as per the android activity lifecycle.
  • 14. opencvView.java • This class contains code relevant for your application, this directly extends the absract opencvViewBase class. • processFrame(byte[] data) o Input comes in as byte[] data as raw camera feed o Using the mat.put() this picture can be stored in a matrix o Any openCV functions from imgproc etc.. can be performed on this mat object o Display must be in bitmap format, so the mat object is converted to bmp o This bmp object is returned to run() which displays it on the screen.
  • 15. • Camera mCamera; o Camera object to open/close/ retrieve video information • SurfaceHolder mHolder; o Holder to the surfaceview to enable a live streaming of video • Mat mRgba; o Matrix Object that openCV uses for image manipulation • Bitmap mBitmap; o Bitmap object that can be displayed on the surface view • mRgba.put(0, 0, data); o Returns the raw data feed in an openCV matrix format. • Imgproc.cvtColor(mGraySubmat, mRgba, Imgproc.COLOR_GRAY2RGBA, 4); o How to convert an RGB matrix to a greyscale • Utils.matToBitmap(mRgba, bmp); o Converting a matrix to a bitmap
  • 17. Real time Face detection • fdActivity example is an openCV sample that shows how to implement face detection algorithm on a real time video stream. • It is also an example on how to efficiently implement an algorithm in C and call it via the JNI interface. • Also implements an FPS meter class to judge the usability of the algorithm used. • A Haar Classifier from the ml library with the openCV trained xml file is used on the image stream to return if the image contains a face or not. • It is the standard openCV way of face detetcion.
  • 18. Possible Applications on android devices • Obtain features from any image and send it over network for matching against an online database for object recognition. • Use the front camera to monitor head movement and provide a hands free interface for some games. • Auto-tagging of friends in photos taken and associating them with facebook/android contacts.