You are previewing Android Application Programming with OpenCV 3.
O'Reilly logo
Android Application Programming with OpenCV 3

Book Description

Build Android apps to capture, manipulate, and track objects in 2D and 3D

In Detail

Android Application Programming with OpenCV 3 is a practical, hands-on guide to computer vision and mobile app development. It shows how to capture, manipulate, and analyze images while building an application that combines photography and augmented reality. To help the reader become a well-rounded developer, the book covers OpenCV (a computer vision library), Android SDK (a mobile app framework), OpenGL ES (a 3D graphics framework), and even JNI (a Java/C++ interoperability layer).

Now in its second edition, the book offers thoroughly reviewed code, instructions, and explanations. It is fully updated to support OpenCV 3 and Android 5, as well as earlier versions. Although it focuses on OpenCV's Java bindings, this edition adds an extensive chapter on JNI and C++, so that the reader is well primed to use OpenCV in other environments.

What You Will Learn

  • Install OpenCV and an Android development environment on Windows, Mac, or Linux

  • Share photos with other apps via Android's MediaStore and Intent classes

  • Create GUIs and handle events using Android activities and OpenCV

  • Train an image recognizer that can locate famous paintings in a scene

  • Apply "curves" and other color transformations to simulate the look of old photos

  • Apply convolution filters that sharpen, blur, emboss, or darken the details of an image

  • 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 If you purchased this book elsewhere, you can visit and register to have the files e-mailed directly to you.

    Table of Contents

    1. Android Application Programming with OpenCV 3
      1. Table of Contents
      2. Android Application Programming with OpenCV 3
      3. Credits
      4. About the Author
      5. About the Reviewers
        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. Setting Up OpenCV
        1. System requirements
        2. Setting up a development environment
          1. Getting prebuilt OpenCV4Android
          2. Building OpenCV4Android from source
        3. Building the OpenCV samples with Eclipse
        4. Troubleshooting Eclipse projects
        5. Troubleshooting the USB connection
        6. Finding the documentation and help
        7. Summary
      9. 2. Working with Camera Frames
        1. Designing our app – Second Sight
        2. Creating the Eclipse project
          1. Enabling camera and disk access in the manifest
          2. Creating menu and string resources
          3. Previewing and saving photos in CameraActivity
          4. Deleting, editing, and sharing photos in LabActivity
        3. Summary
      10. 3. Applying Image Effects
        1. Adding files to the project
          1. Defining the Filter interface
        2. Mixing color channels
        3. Making subtle color shifts with curves
        4. Mixing pixels with convolution filters
        5. Adding the filters to CameraActivity
        6. Summary
      11. 4. Recognizing and Tracking Images
        1. Adding files to the project
        2. Understanding image tracking
        3. Writing an image tracking filter
        4. Adding the tracker filters to CameraActivity
        5. Summary
      12. 5. Combining Image Tracking with 3D Rendering
        1. Adding files to the project
        2. Defining the ARFilter interface
        3. Building projection matrices in CameraProjectionAdapter
        4. Modifying ImageDetectionFilter for 3D tracking
        5. Rendering the cube in ARCubeRenderer
        6. Adding 3D tracking and rendering to CameraActivity
        7. Learning more about 3D graphics on Android
        8. Summary
      13. 6. Mixing Java and C++ via JNI
        1. Understanding the role of JNI
        2. Measuring performance
        3. Adding files to the project
        4. Building the native library
        5. Modifying the filter interface
        6. Porting the channel-mixing filters to C++
        7. Porting the edge-enhancing filter to C++
        8. Porting the ARFilter to C++
        9. Learning more about OpenCV and C++
        10. Summary
      14. Index