Mastering OpenCV with Practical Computer Vision Projects

Book description

This is the definitive advanced tutorial for OpenCV, designed for those with basic C++ skills. The computer vision projects are divided into easily assimilated chapters with an emphasis on practical involvement for an easier learning curve.

  • Cool, fun and advanced projects that cover the various aspects of OpenCV programming
  • Strong emphasis on programming techniques and methodology for the best approach to each project
  • Ten projects that are carefully designed to build on your skills at every step

In Detail

OpenCV is a computer vision library that is extensively used in companies, research groups and governmental bodies for real-time capture, video file import, image manipulation, object detection and much more. Its comprehensive set of computer vision and machine learning algorithms makes it the obvious choice for professionals to develop visual applications.

With this book in hand, you would not need to plow through several pages of theory as this book will take you through the creation of many exciting projects that showcase the huge range of possibilities that open up when OpenCV is exploited to its full potential.

Table of contents

  1. Mastering OpenCV with Practical Computer Vision Projects
    1. Table of Contents
    2. Mastering OpenCV with Practical Computer Vision Projects
    3. Credits
    4. About the Authors
    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. Errata
        3. Piracy
        4. Questions
    8. 1. Cartoonifier and Skin Changer for Android
      1. Accessing the webcam
      2. Main camera processing loop for a desktop app
      3. Generating a black-and-white sketch
      4. Generating a color painting and a cartoon
      5. Generating an "evil" mode using edge filters
      6. 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
      7. Porting from desktop to Android
        1. Setting up an Android project that uses OpenCV
          1. Color formats used for image processing on Android
          2. Input color format from the camera
          3. Output color format for display
        2. Adding the cartoonifier code to the Android NDK app
          1. Reviewing the Android app
          2. Cartoonifying the image when the user taps the screen
          3. Saving the image to a file and to the Android picture gallery
        3. Showing an Android notification message about a saved image
          1. Changing cartoon modes through the Android menu bar
        4. Reducing the random pepper noise from the sketch image
          1. Showing the FPS of the app
          2. Using a different camera resolution
          3. Customizing the app
      8. Summary
    9. 2. Marker-based Augmented Reality on iPhone or iPad
      1. Creating an iOS project that uses OpenCV
        1. Adding OpenCV framework
        2. Including OpenCV headers
      2. Application architecture
        1. Accessing the camera
      3. Marker detection
        1. Marker identification
          1. Grayscale conversion
          2. Image binarization
          3. Contours detection
          4. Candidates search
        2. Marker code recognition
          1. Reading marker code
          2. Marker location refinement
      4. Placing a marker in 3D
        1. Camera calibration
        2. Marker pose estimation
      5. Rendering the 3D virtual object
        1. Creating the OpenGL rendering layer
        2. Rendering an AR scene
      6. Summary
      7. References
    10. 3. Marker-less Augmented Reality
      1. Marker-based versus marker-less AR
      2. Using feature descriptors to find an arbitrary image on video
        1. Feature extraction
        2. Definition of a pattern object
        3. Matching of feature points
          1. PatternDetector.cpp
        4. Outlier removal
          1. Cross-match filter
          2. Ratio test
            1. PatternDetector.cpp
          3. Homography estimation
            1. PatternDetector.cpp
          4. Homography refinement
            1. PatternDetector.cpp
        5. Putting it all together
      3. Pattern pose estimation
        1. PatternDetector.cpp
        2. Obtaining the camera-intrinsic matrix
          1. Pattern.cpp
      4. Application infrastructure
        1. ARPipeline.hpp
        2. ARPipeline.cpp
        3. Enabling support for 3D visualization in OpenCV
        4. Creating OpenGL windows using OpenCV
        5. Video capture using OpenCV
        6. Rendering augmented reality
          1. ARDrawingContext.hpp
          2. ARDrawingContext.cpp
        7. Demonstration
          1. main.cpp
      5. Summary
      6. References
    11. 4. 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. Point matching using optical flow
        3. Finding camera matrices
      3. Reconstructing the scene
      4. Reconstruction from many views
      5. Refinement of the reconstruction
      6. Visualizing 3D point clouds with PCL
      7. Using the example code
      8. Summary
      9. References
    12. 5. Number Plate Recognition Using SVM and Neural Networks
      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
    13. 6. 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
    14. 7. 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 Active Appearance Model
      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
    15. 8. 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
    16. Index

Product information

  • Title: Mastering OpenCV with Practical Computer Vision Projects
  • Author(s): Baggio, Shervin Emami, David Millán Escrivá, Khvedchenia Ievgen
  • Release date: November 2012
  • Publisher(s): Packt Publishing
  • ISBN: 9781849517829