OpenCV 3 Computer Vision Application Programming Cookbook - Third Edition

Book description

Recipes to help you build computer vision applications that make the most of the popular C++ library OpenCV 3

About This Book

  • Written to the latest, gold-standard specification of OpenCV 3

  • Master OpenCV, the open source library of the computer vision community

  • Master fundamental concepts in computer vision and image processing

  • Learn about the important classes and functions of OpenCV with complete working examples applied to real images

  • Who This Book Is For

    OpenCV 3 Computer Vision Application Programming Cookbook Third Edition is appropriate for novice C++ programmers who want to learn how to use the OpenCV library to build computer vision applications. It is also suitable for professional software developers who wish to be introduced to the concepts of computer vision programming. It can also be used as a companion book for university-level computer vision courses. It constitutes an excellent reference for graduate students and researchers in image processing and computer vision.

    What You Will Learn

  • Install and create a program using the OpenCV library

  • Process an image by manipulating its pixels

  • Analyze an image using histograms

  • Segment images into homogenous regions and extract meaningful objects

  • Apply image filters to enhance image content

  • Exploit the image geometry in order to relay different views of a pictured scene

  • Calibrate the camera from different image observations

  • Detect people and objects in images using machine learning techniques

  • Reconstruct a 3D scene from images

  • In Detail

    Making your applications see has never been easier with OpenCV. With it, you can teach your robot how to follow your cat, write a program to correctly identify the members of One Direction, or even help you find the right colors for your redecoration.

    OpenCV 3 Computer Vision Application Programming Cookbook Third Edition provides a complete introduction to the OpenCV library and explains how to build your first computer vision program. You will be presented with a variety of computer vision algorithms and exposed to important concepts in image and video analysis that will enable you to build your own computer vision applications.

    This book helps you to get started with the library, and shows you how to install and deploy the OpenCV library to write effective computer vision applications following good programming practices. You will learn how to read and write images and manipulate their pixels. Different techniques for image enhancement and shape analysis will be presented. You will learn how to detect specific image features such as lines, circles or corners. You will be introduced to the concepts of mathematical morphology and image filtering.

    The most recent methods for image matching and object recognition are described, and you'll discover how to process video from files or cameras, as well as how to detect and track moving objects. Techniques to achieve camera calibration and perform multiple-view analysis will also be explained. Finally, you'll also get acquainted with recent approaches in machine learning and object classification.

    Style and approach

    This book will arm you with the basics you need to start writing world-aware applications right from a pixel level all the way through to processing video sequences.

    Table of contents

    1. OpenCV 3 Computer Vision Application Programming Cookbook - Third Edition
      1. OpenCV 3 Computer Vision Application Programming Cookbook - Third Edition
      2. Credits
      3. About the Author
      4. About the Reviewer
      5. www.PacktPub.com
        1. Why subscribe?
      6. Customer Feedback
      7. Preface
        1. What this book covers
        2. What you need for this book
        3. Who this book is for
        4. Sections
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
          5. See also
        5. Conventions
        6. Reader feedback
        7. Customer support
          1. Downloading the example code
          2. Downloading the color images of this book 
          3. Errata
          4. Piracy
          5. Questions
      8. 1. Playing with Images
        1. Introduction
        2. Installing the OpenCV library
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
            1. The Visualization Toolkit and the cv::viz module
            2. The OpenCV developer site
          5. See also
        3. Loading, displaying, and saving images
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
            1. Clicking on images
            2. Drawing on images
          5. See also
        4. Exploring the cv::Mat data structure
          1. How to do it...
          2. How it works...
          3. There's more...
            1. The input and output arrays
            2. Manipulating small matrices
          4. See also
        5. Defining regions of interest
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
            1. Using image masks
          5. See also
      9. 2. Manipulating Pixels
        1. Introduction
        2. Accessing pixel values
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
            1. The cv::Mat_ template class
          5. See also
        3. Scanning an image with pointers
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
            1. Other color reduction formulas
            2. Having input and output arguments
            3. Efficient scanning of continuous images
            4. Low-level pointer arithmetic
          5. See also
        4. Scanning an image with iterators
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        5. Writing efficient image-scanning loops
          1. How to do it...
          2. How it works...
          3. There's more...
          4. See also
        6. Scanning an image with neighbor access
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        7. Performing simple image arithmetic
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
            1. Overloaded image operators
            2. Splitting the image channels
        8. Remapping an image
          1. How to do it...
          2. How it works...
          3. See also
      10. 3. Processing the Colors of an Image
        1. Introduction
        2. Comparing colors using the Strategy design pattern
          1. How to do it…
          2. How it works…
          3. There's more…
            1. Computing the distance between two color vectors
            2. Using OpenCV functions
            3. The floodFill function
            4. Functor or function object
            5. The OpenCV base class for algorithms
          4. See also
        3. Segmenting an image with the GrabCut algorithm
          1. How to do it…
          2. How it works…
          3. See also
        4. Converting color representations
          1. How to do it…
          2. How it works…
          3. See also
        5. Representing colors with hue, saturation, and brightness
          1. How to do it...
          2. How it works…
          3. There's more…
            1. Using colors for detection - skin tone detection
          4. See also
      11. 4. Counting the Pixels with Histograms
        1. Introduction
        2. Computing an image histogram
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
            1. Computing histograms of color images
          5. See also
        3. Applying look-up tables to modify the image's appearance
          1. How to do it...
          2. How it works...
          3. There's more...
            1. Stretching a histogram to improve the image contrast
            2. Applying a look-up table to color images
          4. See also
        4. Equalizing the image histogram
          1. How to do it...
          2. How it works...
        5. Backprojecting a histogram to detect specific image content
          1. How to do it...
          2. How it works...
          3. There's more...
            1. Backprojecting color histograms
          4. See also
        6. Using the mean shift algorithm to find an object
          1. How to do it...
          2. How it works...
          3. See also
        7. Retrieving similar images using the histogram comparison
          1. How to do it...
          2. How it works...
          3. See also
        8. Counting pixels with integral images
          1. How to do it...
          2. How it works...
          3. There's more...
            1. Adaptive thresholding
            2. Visual tracking using histograms
          4. See also
      12. 5. Transforming Images with Morphological Operations
        1. Introduction
        2. Eroding and dilating images using morphological filters
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        3. Opening and closing images using morphological filters
          1. How to do it...
          2. How it works...
          3. See also
        4. Applying morphological operators on gray-level images
          1. How to do it...
          2. How it works...
          3. See also
        5. Segmenting images using watersheds
          1. How to do it...
          2. How it works...
          3. There's more...
          4. See also
        6. Extracting distinctive regions using MSER
          1. How to do it...
          2. How it works...
          3. See also
      13. 6. Filtering the Images
        1. Introduction
        2. Filtering images using low-pass filters
          1. How to do it...
          2. How it works...
          3. See also
        3. Downsampling images with filters
          1. How to do it...
          2. How it works...
          3. There's more...
            1. Interpolating pixel values
          4. See also
        4. Filtering images using a median filter
          1. How to do it...
          2. How it works...
        5. Applying directional filters to detect edges
          1. How to do it...
          2. How it works...
          3. There's more...
            1. Gradient operators
            2. Gaussian derivatives
          4. See also
        6. Computing the Laplacian of an image
          1. How to do it...
          2. How it works...
          3. There's more...
            1. Enhancing the contrast of an image using the Laplacian
            2. Difference of Gaussians
          4. See also
      14. 7. Extracting Lines, Contours, and Components
        1. Introduction
        2. Detecting image contours with the Canny operator
          1. How to do it...
          2. How it works...
          3. See also
        3. Detecting lines in images with the Hough transform
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
            1. Detecting circles
          5. See also
        4. Fitting a line to a set of points
          1. How to do it...
          2. How it works...
          3. There's more...
        5. Extracting connected components
          1. How to do it...
          2. How it works...
          3. There's more...
        6. Computing components' shape descriptors
          1. How to do it...
          2. How it works...
          3. There's more...
            1. Quadrilateral detection
      15. 8. Detecting Interest Points
        1. Introduction
        2. Detecting corners in an image
          1. How to do it...
          2. How it works...
          3. There's more...
            1. Good features to track
          4. See also
        3. Detecting features quickly
          1. How to do it...
          2. How it works...
          3. There's more...
          4. See also
        4. Detecting scale-invariant features
          1. How to do it...
          2. How it works...
          3. There's more...
            1. The SIFT feature-detection algorithm
          4. See also
        5. Detecting FAST features at multiple scales
          1. How to do it...
          2. How it works...
          3. There's more...
            1. The ORB feature-detection algorithm
          4. See also
      16. 9. Describing and Matching Interest Points
        1. Introduction
        2. Matching local templates
          1. How to do it...
          2. How it works...
          3. There's more...
            1. Template matching
          4. See also
        3. Describing and matching local intensity patterns
          1. How to do it...
          2. How it works...
          3. There's more...
            1. Cross-checking matches
            2. The ratio test
            3. Distance thresholding
          4. See also
        4. Matching keypoints with binary descriptors
          1. How to do it...
          2. How it works...
          3. There's more...
            1. FREAK
          4. See also
      17. 10. Estimating Projective Relations in Images
        1. Introduction
          1. Image formation
        2. Computing the fundamental matrix of an image pair
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. See also
        3. Matching images using random sample consensus
          1. How to do it...
          2. How it works...
          3. There's more...
            1. Refining the fundamental matrix
            2. Refining the matches
        4. Computing a homography between two images
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
            1. Generating image panoramas with the cv::Stitcher module
          5. See also
        5. Detecting a planar target in images
          1. How to do it...
          2. How it works...
          3. See also
      18. 11. Reconstructing 3D Scenes
        1. Introduction
          1. Digital image formation
        2. Calibrating a camera
          1. How to do it...
          2. How it works...
          3. There's more...
            1. Calibration with known intrinsic parameters
            2. Using a grid of circles for calibration
          4. See also
        3. Recovering camera pose
          1. How to do it...
          2. How it works...
          3. There's more...
            1. cv::Viz, a 3D Visualizer module
          4. See also
        4. Reconstructing a 3D scene from calibrated cameras
          1. How to do it...
          2. How it works...
          3. There's more...
            1. Decomposing a homography
            2. Bundle adjustment
          4. See also
        5. Computing depth from stereo image
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. See also
      19. 12. Processing Video Sequences
        1. Introduction
        2. Reading video sequences
          1. How to do it...
          2. How it works...
          3. There's more...
          4. See also
        3. Processing the video frames
          1. How to do it...
          2. How it works...
          3. There's more...
            1. Processing a sequence of images
            2. Using a frame processor class
          4. See also
        4. Writing video sequences
          1. How to do it...
          2. How it works...
          3. There's more...
            1. The codec four-character code
          4. See also
        5. Extracting the foreground objects in a video
          1. How to do it...
          2. How it works...
          3. There's more...
            1. The Mixture of Gaussian method
          4. See also
      20. 13. Tracking Visual Motion
        1. Introduction
        2. Tracing feature points in a video
          1. How to do it...
          2. How it works...
          3. See also
        3. Estimating the optical flow
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. See also
        4. Tracking an object in a video
          1. How to do it...
          2. How it works...
          3. See also
      21. 14. Learning from Examples
        1. Introduction
        2. Recognizing faces using nearest neighbors of local binary patterns
          1. How to do it...
          2. How it works...
          3. See also
        3. Finding objects and faces with a cascade of Haar features
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
            1. Face detection with a Haar cascade
          5. See also
        4. Detecting objects and people with Support Vector Machines and histograms of oriented gradients
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
            1. HOG visualization
            2. People detection
            3. Deep learning and Convolutional Neural Networks
          5. See also

    Product information

    • Title: OpenCV 3 Computer Vision Application Programming Cookbook - Third Edition
    • Author(s): Robert Laganiere
    • Release date: February 2017
    • Publisher(s): Packt Publishing
    • ISBN: 9781786469717