O'Reilly logo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

OpenCV Android Programming By Example

Book Description

Develop vision-aware and intelligent Android applications with the robust OpenCV library

About This Book

  • This is the most up-to-date book on OpenCV Android programming on the market at the moment. There is no direct competition for our title.
  • Based on a technology that is increasing in popularity, proven by activity in forums related to this topic.
  • This book uniquely covers applications such as the Panoramic viewer and Automatic Selfie, among others.

Who This Book Is For

If you are an Android developer and want to know how to implement vision-aware applications using OpenCV, then this book is definitely for you.

It would be very helpful if you understand the basics of image processing and computer vision, but no prior experience is required

What You Will Learn

  • Identify and install all the elements needed to start building vision-aware Android applications
  • Explore image representation, colored and gray scale
  • Recognize and apply convolution operations and filtering to deal with noisy data
  • Use different shape analysis techniques
  • Extract and identify interest points in an image
  • Understand and perform object detection
  • Run native computer vision algorithms and gain performance boosts

In Detail

Starting from the basics of computer vision and OpenCV, we'll take you all the way to creating exciting applications. You will discover that, though computer vision is a challenging subject, the ideas and algorithms used are simple and intuitive, and you will appreciate the abstraction layer that OpenCV uses to do the heavy lifting for you. Packed with many examples, the book will help you understand the main data structures used within OpenCV, and how you can use them to gain performance boosts. Next we will discuss and use several image processing algorithms such as histogram equalization, filters, and color space conversion. You then will learn about image gradients and how they are used in many shape analysis techniques such as edge detection, Hough Line Transform, and Hough Circle Transform. In addition to using shape analysis to find things in images, you will learn how to describe objects in images in a more robust way using different feature detectors and descriptors.

By the end of this book, you will be able to make intelligent decisions using the famous Adaboost learning algorithm.

Style and approach

An easy-to-follow tutorial packed with hands-on examples. Each topic is explained and placed in context, and the book supplies full details of the concepts used for added proficiency.

Downloading the example code for this book. You can download the example code files for all Packt books you have purchased from your account at http://www.PacktPub.com. If you purchased this book elsewhere, you can visit http://www.PacktPub.com/support and register to have the code file.

Table of Contents

  1. OpenCV Android Programming By Example
    1. Table of Contents
    2. OpenCV Android Programming By Example
    3. Credits
    4. About the Author
    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. Getting Yourself Ready
      1. Installing Tegra Android Development Pack
        1. Downloading and installing TADP
        2. TADP post-installation configuration
          1. Installing emulator system images
          2. Configuring Eclipse to work with NDK
          3. NDK verification
      2. Installing the OpenCV and Android development environment manually
        1. Java SE Development Kit 6
        2. Android Studio
        3. Android SDK
        4. Eclipse IDE
        5. ADT and CDT plugins for Eclipse
        6. Android NDK
          1. Downloading Android NDK
          2. Installing and configuring Android NDK
          3. Building native code using Eclipse
        7. OpenCV4Android SDK
      3. Understanding how NDK works
        1. An overview of NDK
          1. A simple example of NDK
            1. Android.mk
      4. Building your first Android project with OpenCV
        1. HelloVisionWorld Android application
          1. Creating a project in Eclipse
          2. Creating a project in Android Studio
      5. Summary
    9. 2. App 1 - Building Your Own Darkroom
      1. Digital images
        1. Color spaces
        2. The Mat class
          1. Basic Mat operations
      2. Processing the images stored on your phone
        1. Loading an image to a Mat object
          1. UI definitions
          2. Reading an image using OpenCV
      3. Calculating an image histogram
        1. What are histograms?
          1. Understanding histogram components
            1. UI definitions
            2. Calculating an image histogram
      4. Enhancing the image contrast
        1. Understanding histogram equalization
          1. Enhancing grayscale images
            1. UI definitions
            2. Converting an image to grayscale
            3. Equalizing a histogram for a grayscale image
          2. Enhancing an HSV image
            1. UI definitions
            2. Equalizing a histogram for the image saturation and value
          3. Enhancing an RGB image
            1. UI definitions
            2. Equalizing a histogram for the image color channels
      5. Summary
    10. 3. App 2 - Software Scanner
      1. Spatial filtering
        1. Understanding convolution and linear filtering
        2. Removing noise
          1. The averaging filter
          2. The Gaussian filter
          3. The median filter
          4. UI definitions
          5. Applying filters to reduce image noise
        3. Finding edges
          1. The Sobel edge detector
          2. The Canny edge detector
          3. UI definitions
          4. Applying the Sobel filter to find edges
          5. Using the Canny edge detector
      2. Detecting shapes
        1. Understanding the Hough line transform
        2. Detecting lines using Hough transform
          1. UI definitions
          2. Detecting and drawing lines
        3. Detecting circles using Hough transform
          1. UI definitions
          2. Detecting and drawing circles
      3. Summary
    11. 4. App 2 - Applying Perspective Correction
      1. Image transformations and perspective correction
        1. Translation
        2. Rotation and translation
        3. Scaled rotation
        4. Affine
        5. Perspective transformation
      2. Rigid perspective correction
        1. UI definitions
        2. Estimating the perspective transformation using the object bounding box
      3. Flexible perspective correction
        1. UI definitions
        2. Applying flexible perspective correction
      4. Manual perspective correction
        1. UI definitions
        2. Selecting the corners manually
      5. Summary
    12. 5. App 3 - Panoramic Viewer
      1. Image features
        1. Feature detectors
          1. Understanding the Harris corner detector
            1. UI definitions
            2. Using the Harris corner detector
            3. Calling a native Harris corner detector
              1. Using the native OpenCV library within Eclipse
              2. Using the native OpenCV library within Android Studio
              3. Working on the native part
          2. Understanding the FAST corner detector
            1. UI definitions
            2. Using the FAST corner detector
            3. Using native FAST
          3. Understanding the ORB feature detector
            1. UI definitions
            2. Using the ORB feature detector
            3. Using native ORB
        2. Feature description and matching
          1. Understanding BRIEF and ORB feature descriptors
          2. Understanding the BRISK feature descriptor
          3. Understanding the FREAK feature descriptor
          4. Matching the features
          5. Working with feature matching
            1. UI definitions
            2. Finding an object in a scene
          6. Native feature matching
            1. UI definitions
            2. The native matching process
          7. Stitching two images
            1. UI definitions
            2. The native stitcher
      2. Summary
    13. 6. App 4 – Automatic Selfie
      1. Cascade classifiers
        1. Haar-like features
        2. The integral image
        3. Adaptive Boosting
        4. Cascading
      2. Using cascade classifiers to detect objects
        1. Accessing your phone's camera using OpenCV
          1. A camera preview
            1. UI definitions
            2. Previewing the camera frames
        2. Detecting closed palms in the camera frames
          1. Using the Java-based cascade classifier
      3. Summary
    14. Index