Safari, the world’s most comprehensive technology and business learning platform.

Find the exact information you need to solve a problem on the fly, or go deeper to master the technologies and skills you need to succeed

Start Free Trial

No credit card required

O'Reilly logo
OpenCV Essentials

Book Description

Acquire, process, and analyze visual content to build full-fledged imaging applications using OpenCV

In Detail

OpenCV, arguably the most widely used computer vision library, includes hundreds of ready-to-use imaging and vision functions used in both academia and industry. It mainly focuses on real-time image processing. As cameras get cheaper and imaging features grow in demand, the range of applications using OpenCV increases significantly, both for desktop and mobile platforms.

The book provides an example-based tour of OpenCV's main modules and algorithms, including the latest available in version 3.0. Starting with the setup and description of the library, this book teaches you how to add graphical user interface capabilities to OpenCV programs. Further, you will learn about the essential techniques such as image processing, image segmentation, object detection, and motion, which will help you process and analyze images better. You will also learn how to extract 2D features from images and how to take advantage of machine learning. By the end of this book, you will completely understand how to put those computer vision techniques into practice.

What You Will Learn

  • Explore advanced image processing techniques such as the retina algorithm, morphing, and color transfer
  • Create programs using advanced segmentation tools such as the new connectedComponents and connectedComponentsWithStats functions
  • Use flood filling along with the watershed transform to obtain better segmentations
  • Explore the new powerful KAZE features
  • Use advanced video-based background/foreground segmentation for class BackgroundSubtractor and ECC-based warping
  • Leverage the available object detection frameworks and the new scene text detection functionality
  • Get a grasp of advanced topics such as machine learning and GPU optimization
  • 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. OpenCV Essentials
      1. Table of Contents
      2. OpenCV Essentials
      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. Downloading the color images of this book
          3. Errata
          4. Piracy
          5. Questions
      8. 1. Getting Started
        1. Setting up OpenCV
          1. Compiled versus precompiled library
            1. Configuring OpenCV with CMake
            2. Building and installing the library
          2. Quick recipe for setting up OpenCV
        2. API concepts and basic datatypes
        3. Our first program – reading and writing images and videos
          1. The qmake project file
        4. Reading and playing a video file
        5. Live input from a camera
        6. Summary
      9. 2. Something We Look At – Graphical User Interfaces
        1. Using OpenCV's highgui module
        2. Text and drawing
        3. Selecting regions
        4. Using Qt-based functions
          1. Text overlays and status bar
          2. The properties dialog
          3. Windows properties
          4. Qt images
        5. Summary
      10. 3. First Things First – Image Processing
        1. Pixel-level access and common operations
        2. Image histogram
        3. Histogram equalization
        4. Brightness and contrast modeling
        5. Histogram matching and LUT
        6. Conversion from RGB to other color spaces
        7. Filtering with the retina model
        8. Arithmetic and geometrical transforms
          1. Arithmetic transform
          2. Geometrical transforms
        9. Summary
        10. What else?
      11. 4. What's in the Image? Segmentation
        1. Thresholding
        2. Contours and connected components
        3. Flood fill
        4. Watershed segmentation
        5. GrabCut
        6. Summary
        7. What else?
      12. 5. Focusing on the Interesting 2D Features
        1. Interest points
        2. Feature detectors
          1. The FAST detector
          2. The SURF detector
          3. The ORB detector
          4. The KAZE and AKAZE detectors
        3. Feature descriptor extractors
        4. Descriptor matchers
          1. Matching the SURF descriptors
          2. Matching the AKAZE descriptors
        5. Summary
        6. What else?
      13. 6. Where's Wally? Object Detection
        1. Object detection
        2. Detecting objects with OpenCV
        3. Cascades are beautiful
          1. Object detection using cascades
          2. Training your own cascade
        4. Latent SVM
        5. Scene text detection
        6. Summary
        7. What else?
      14. 7. What Is He Doing? Motion
        1. Motion history
        2. Reading video sequences
        3. The Lucas-Kanade optical flow
        4. The Gunnar-Farneback optical flow
        5. The Mean-Shift tracker
        6. The CamShift tracker
        7. The Motion templates
          1. The Motion history template
          2. The Motion gradient
        8. The Background subtraction technique
        9. Image alignment
        10. Summary
        11. What else?
      15. 8. Advanced Topics
        1. Machine learning
        2. The KNN classifier
        3. The Random Forest classifier
        4. SVM for classification
        5. What about GPUs?
        6. Setting up OpenCV with CUDA
          1. Configuring the OpenCV build
          2. Building and installing the library
          3. A quick recipe for setting up OpenCV with CUDA
        7. Our first GPU-based program
        8. Going real time
          1. Performance
        9. Summary
        10. What else?
      16. Index