Mastering OpenCV Android Application Programming

Book description

Master the art of implementing computer vision algorithms on Android platforms to build robust and efficient applications

In Detail

OpenCV is a famous computer vision library, used to analyze and transform copious amounts of image data, even in real time and on a mobile device.

This book focuses on leveraging mobile platforms to build interactive and useful applications. The book starts off with an introduction to OpenCV and Android and how they interact with each other using OpenCV's Java API. You'll also discover basic image processing techniques such as erosion and dilation of images, before walking through how to build more complex applications, such as object detection, image stitching, and face detection. As you progress, you will be introduced to OpenCV's machine learning framework, enabling you to make your applications smarter.

The book ends with a short chapter covering useful Android tips and tricks and some common errors and solutions that people might face while building an application. By the end of the book, readers will have gained more expertise in building their own OpenCV projects for the Android platform and integrating OpenCV application programming into existing projects.

What You Will Learn

  • Understand image processing using OpenCV
  • Detect specific objects in an image or video using various state-of-the-art feature-matching algorithms such as SIFT, SURF, and ORB
  • Perform image transformations such as changing color, space, resizing, applying filters like Gaussian blur, and likes
  • Use mobile phone cameras to interact with the real world
  • Explore face detection, object detection, and image stitching in OpenCV Android programming
  • Build smarter applications by using machine learning algorithms
  • Learn to debug applications and create optimal custom algorithms by understanding how data is stored internally

Table of contents

  1. Mastering OpenCV Android Application Programming
    1. Table of Contents
    2. Mastering OpenCV Android Application Programming
    3. Credits
    4. About the Authors
    5. About the Reviewers
    6. www.PacktPub.com
      1. Support files, eBooks, discount offers, and more
        1. Why subscribe?
        2. Free access for Packt account holders
    7. Preface
      1. What this book covers
      2. What you need for this book
      3. Who this book is for
      4. Conventions
      5. Reader feedback
      6. Customer support
        1. Downloading the example code
        2. Downloading the color images of this book
        3. Errata
        4. Piracy
        5. Questions
    8. 1. Applying Effects to Images
      1. Getting started
      2. Setting up OpenCV
      3. Storing images in OpenCV
      4. Linear filters in OpenCV
        1. The mean blur method
        2. The Gaussian blur method
        3. The median blur method
        4. Creating custom kernels
        5. Morphological operations
          1. Dilation
          2. Erosion
        6. Thresholding
        7. Adaptive thresholding
      5. Summary
    9. 2. Detecting Basic Features in Images
      1. Creating our application
      2. Edge and Corner detection
        1. The Difference of Gaussian technique
        2. The Canny Edge detector
        3. The Sobel operator
        4. Harris Corner detection
      3. Hough transformations
        1. Hough lines
        2. Hough circles
      4. Contours
      5. Project – detecting a Sudoku puzzle in an image
      6. Summary
    10. 3. Detecting Objects
      1. What are features?
      2. Scale Invariant Feature Transform
        1. Understanding how SIFT works
          1. Scale-space extrema detection
          2. Keypoint localization
          3. Orientation assignment
          4. Keypoint descriptor
        2. SIFT in OpenCV
      3. Matching features and detecting objects
        1. Brute-force matcher
        2. FLANN based matcher
        3. Matching the points
        4. Detecting objects
      4. Speeded Up Robust Features
        1. SURF detector
        2. SURF descriptor
          1. Orientation assignment
          2. Descriptor based on Haar wavelet responses
        3. SURF in OpenCV
      5. Oriented FAST and Rotated BRIEF
        1. oFAST – FAST keypoint orientation
          1. FAST detector
          2. Orientation by intensity centroid
        2. rBRIEF – Rotation-aware BRIEF
          1. Steered BRIEF
          2. Variance and correlation
        3. ORB in OpenCV
      6. Binary Robust Invariant Scalable Keypoints
        1. Scale-space keypoint detection
        2. Keypoint description
          1. Sampling pattern and rotation estimation
          2. Building the descriptor
        3. BRISK In OpenCV
      7. Fast Retina Keypoint
        1. A retinal sampling pattern
        2. A coarse-to-fine descriptor
        3. Saccadic search
        4. Orientation
        5. FREAK in OpenCV
      8. Summary
    11. 4. Drilling Deeper into Object Detection – Using Cascade Classifiers
      1. An introduction to cascade classifiers
        1. Haar cascades
        2. LBP cascades
      2. Face detection using the cascade classifier
      3. HOG descriptors
      4. Project – Happy Camera
      5. Summary
    12. 5. Tracking Objects in Videos
      1. Optical flow
        1. The Horn and Schunck method
        2. The Lucas and Kanade method
        3. Checking out the optical flow on Android
      2. Image pyramids
        1. Gaussian pyramids
        2. Laplacian pyramids
          1. Gaussian and Laplacian pyramids in OpenCV
      3. Basic 2D transformations
      4. Global motion estimation
      5. The Kanade-Lucas-Tomasi tracker
        1. Checking out the KLT tracker on OpenCV
      6. Summary
    13. 6. Working with Image Alignment and Stitching
      1. Image stitching
        1. Feature detection and matching
        2. Image matching
          1. Homography estimation using RANSAC
          2. Verification of image matches using a probabilistic model
        3. Bundle adjustment
        4. Automatic panoramic straightening
        5. Gain compensation
        6. Multi-band blending
        7. Image stitching using OpenCV
          1. Setting up Android NDK
          2. The layout and Java code
          3. The C++ code
      2. Summary
    14. 7. Bringing Your Apps to Life with OpenCV Machine Learning
      1. Optical Character Recognition
        1. OCR using k-nearest neighbors
          1. Making a camera application
          2. Handling the training data
          3. Recognizing digits
        2. OCR using Support Vector Machines
      2. Solving a Sudoku puzzle
        1. Recognizing digits in the puzzle
      3. Summary
    15. 8. Troubleshooting and Best Practices
      1. Troubleshooting errors
        1. Permission errors
          1. Some common permissions
        2. Debugging code using Logcat
      2. Best practices
        1. Handling images in Android
          1. Loading images
          2. Processing images
        2. Handling data between multiple activities
          1. Transferring data via Intent
          2. Using static fields
          3. Using a database or a file
      3. Summary
    16. 9. Developing a Document Scanning App
      1. Let's begin
      2. The algorithm
      3. Implementing on Android
      4. Summary
    17. Index

Product information

  • Title: Mastering OpenCV Android Application Programming
  • Author(s): Salil Kapur, Nisarg Thakkar
  • Release date: July 2015
  • Publisher(s): Packt Publishing
  • ISBN: 9781783988204