Mastering OpenCV 3 - Second Edition

Book description

Practical Computer Vision Projects

About This Book

  • Updated for OpenCV 3, this book covers new features that will help you unlock the full potential of OpenCV 3
  • Written by a team of 7 experts, each chapter explores a new aspect of OpenCV to help you make amazing computer-vision aware applications
  • Project-based approach with each chapter being a complete tutorial, showing you how to apply OpenCV to solve complete problems

Who This Book Is For

This book is for those who have a basic knowledge of OpenCV and are competent C++ programmers. You need to have an understanding of some of the more theoretical/mathematical concepts, as we move quite quickly throughout the book.

What You Will Learn

  • Execute basic image processing operations and cartoonify an image
  • Build an OpenCV project natively with Raspberry Pi and cross-compile it for Raspberry Pi.text
  • Extend the natural feature tracking algorithm to support the tracking of multiple image targets on a video
  • Use OpenCV 3's new 3D visualization framework to illustrate the 3D scene geometry
  • Create an application for Automatic Number Plate Recognition (ANPR) using a support vector machine and Artificial Neural Networks
  • Train and predict pattern-recognition algorithms to decide whether an image is a number plate
  • Use POSIT for the six degrees of freedom head pose
  • Train a face recognition database using deep learning and recognize faces from that database

In Detail

As we become more capable of handling data in every kind, we are becoming more reliant on visual input and what we can do with those self-driving cars, face recognition, and even augmented reality applications and games. This is all powered by Computer Vision.

This book will put you straight to work in creating powerful and unique computer vision applications. Each chapter is structured around a central project and deep dives into an important aspect of OpenCV such as facial recognition, image target tracking, making augmented reality applications, the 3D visualization framework, and machine learning. You'll learn how to make AI that can remember and use neural networks to help your applications learn.

By the end of the book, you will have created various working prototypes with the projects in the book and will be well versed with the new features of OpenCV3.

Style and approach

This book takes a project-based approach and helps you learn about the new features by putting them to work by implementing them in your own projects.

Publisher resources

Download Example Code

Table of contents

  1. 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
  2. Cartoonifier and Skin Changer for Raspberry Pi
    1. Accessing the webcam
    2. Main camera processing loop for a desktop app
      1. Generating a black and white sketch
      2. Generating a color painting and a cartoon
      3. Generating an evil mode using edge filters
      4. Generating an alien mode using skin detection
        1. Skin detection algorithm
        2. Showing the user where to put their face
    3. Implementation of the skin color changer
    4. Summary
  3. Exploring Structure from Motion Using OpenCV
    1. Structure from Motion concepts
    2. Estimating the camera motion from a pair of images
      1. Point matching using rich feature descriptors
      2. Finding camera matrices
      3. Choosing the image pair to use first
    3. Reconstructing the scene
    4. Reconstruction from many views
    5. Refinement of the reconstruction
    6. Using the example code
    7. Summary
    8. References
  4. Number Plate Recognition using SVM and Neural Network
    1. Introduction to ANPR
    2. ANPR algorithm
    3. Plate detection
      1. Segmentation
      2. Classification
    4. Plate recognition
      1. OCR segmentation
      2. Feature extraction
      3. OCR classification
      4. Evaluation
    5. Summary
  5. Non-Rigid Face Tracking
    1. Overview
    2. Utilities
      1. Object-oriented design
      2. Data collection - image and video annotation
        1. Training data types
        2. Annotation tool
        3. Pre-annotated data (the MUCT dataset)
    3. Geometrical constraints
      1. Procrustes analysis
      2. Linear shape models
      3. A combined local-global representation
      4. Training and visualization
    4. Facial feature detectors
      1. Correlation-based patch models
        1. Learning discriminative patch models
        2. Generative versus discriminative patch models
      2. Accounting for global geometric transformations
      3. Training and visualization
    5. Face detection and initialization
    6. Face tracking
      1. Face tracker implementation
      2. Training and visualization
      3. Generic versus person-specific models
    7. Summary
    8. References
  6. 3D Head Pose Estimation Using AAM and POSIT
    1. Active Appearance Models overview
    2. Active Shape Models
      1. Getting the feel of PCA
      2. Triangulation
      3. Triangle texture warping
    3. Model Instantiation - playing with the AAM
    4. AAM search and fitting
    5. POSIT
      1. Diving into POSIT
      2. POSIT and head model
      3. Tracking from webcam or video file
    6. Summary
    7. References
  7. Face Recognition Using Eigenfaces or Fisherfaces
    1. Introduction to face recognition and face detection
      1. Step 1 - face detection
        1. Implementing face detection using OpenCV
        2. Loading a Haar or LBP detector for object or face detection
        3. Accessing the webcam
        4. Detecting an object using the Haar or LBP Classifier
          1. Grayscale color conversion
          2. Shrinking the camera image
          3. Histogram equalization
      2. Detecting the face
      3. Step 2 - face preprocessing
        1. Eye detection
        2. Eye search regions
          1. Geometrical transformation
          2. Separate histogram equalization for left and right sides
          3. Smoothing
          4. Elliptical mask
      4. Step 3 - Collecting faces and learning from them
        1. Collecting preprocessed faces for training
        2. Training the face recognition system from collected faces
        3. Viewing the learned knowledge
        4. Average face
        5. Eigenvalues, Eigenfaces, and Fisherfaces
      5. Step 4 - face recognition
        1. Face identification - recognizing people from their face
        2. Face verification - validating that it is the claimed person
      6. Finishing touches - saving and loading files
      7. Finishing touches - making a nice and interactive GUI
        1. Drawing the GUI elements
          1. Startup mode
          2. Detection mode
          3. Collection mode
          4. Training mode
          5. Recognition mode
        2. Checking and handling mouse clicks
    2. Summary
    3. References

Product information

  • Title: Mastering OpenCV 3 - Second Edition
  • Author(s): Daniel Lélis Baggio, Shervin Emami, David Millán Escrivá, Khvedchenia Ievgen, Jason Saragih, Roy Shilkrot
  • Release date: April 2017
  • Publisher(s): Packt Publishing
  • ISBN: 9781786467171