0%

Book Description

Get to grips with traditional computer vision algorithms and deep learning approaches, and build real-world applications with OpenCV and other machine learning frameworks

Key Features

  • Understand how to capture high-quality image data, detect and track objects, and process the actions of animals or humans
  • Implement your learning in different areas of computer vision
  • Explore advanced concepts in OpenCV such as machine learning, artificial neural network, and augmented reality

Book Description

OpenCV is a native cross-platform C++ library for computer vision, machine learning, and image processing. It is increasingly being adopted in Python for development. This book will get you hands-on with a wide range of intermediate to advanced projects using the latest version of the framework and language, OpenCV 4 and Python 3.8, instead of only covering the core concepts of OpenCV in theoretical lessons. This updated second edition will guide you through working on independent hands-on projects that focus on essential OpenCV concepts such as image processing, object detection, image manipulation, object tracking, and 3D scene reconstruction, in addition to statistical learning and neural networks.

You'll begin with concepts such as image filters, Kinect depth sensor, and feature matching. As you advance, you'll not only get hands-on with reconstructing and visualizing a scene in 3D but also learn to track visually salient objects. The book will help you further build on your skills by demonstrating how to recognize traffic signs and emotions on faces. Later, you'll understand how to align images, and detect and track objects using neural networks.

By the end of this OpenCV Python book, you'll have gained hands-on experience and become proficient at developing advanced computer vision apps according to specific business needs.

What you will learn

  • Generate real-time visual effects using filters and image manipulation techniques such as dodging and burning
  • Recognize hand gestures in real-time and perform hand-shape analysis based on the output of a Microsoft Kinect sensor
  • Learn feature extraction and feature matching to track arbitrary objects of interest
  • Reconstruct a 3D real-world scene using 2D camera motion and camera reprojection techniques
  • Detect faces using a cascade classifier and identify emotions in human faces using multilayer perceptrons
  • Classify, localize, and detect objects with deep neural networks

Who this book is for

This book is for intermediate-level OpenCV users who are looking to enhance their skills by developing advanced applications. Familiarity with OpenCV concepts and Python libraries, and basic knowledge of the Python programming language are assumed.

Table of Contents

  1. Title Page
  2. Copyright and Credits
    1. OpenCV 4 with Python Blueprints Second Edition
  3. About Packt
    1. Why subscribe?
  4. Contributors
    1. About the authors
    2. About the reviewer
    3. Packt is searching for authors like you
  5. Preface
    1. Who this book is for
    2. What this book covers
    3. To get the most out of this book
      1. Download the example code files
      2. Code in Action
      3. Download the color images
      4. Conventions used
    4. Get in touch
      1. Reviews
  6. Fun with Filters
    1. Getting started
    2. Planning the app
    3. Creating a black-and-white pencil sketch
      1. Understanding approaches for using dodging and burning techniques
      2. Implementing a Gaussian blur with two-dimensional convolution
      3. Applying pencil sketch transformation
        1. Using an optimized version of a Gaussian blur
    4. Generating a warming and cooling filter
      1. Using color manipulation via curve shifting
      2. Implementing a curve filter using lookup tables
      3. Designing the warming and cooling effect
    5. Cartoonizing an image
      1. Using a bilateral filter for edge-aware smoothing
      2. Detecting and emphasizing prominent edges
      3. Combining colors and outlines to produce a cartoon
    6. Putting it all together
      1. Running the app
      2. Mapping the GUI base class
        1. Understanding the GUI constructor
          1. Learning about a basic GUI layout
          2. Handling video streams
      3. Drafting a custom filter layout
    7. Summary
    8. Attributions
  7. Hand Gesture Recognition Using a Kinect Depth Sensor
    1. Getting started
    2. Planning the app
    3. Setting up the app
      1. Accessing the Kinect 3D sensor
      2. Utilizing OpenNI-compatible sensors
      3. Running the app and main function routine
    4. Tracking hand gestures in real time
    5. Understanding hand region segmentation
      1. Finding the most prominent depth of the image center region
      2. Applying morphological closing for smoothening
      3. Finding connected components in a segmentation mask
    6. Performing hand shape analysis
      1. Determining the contour of the segmented hand region
      2. Finding the convex hull of a contour area
      3. Finding the convexity defects of a convex hull
    7. Performing hand gesture recognition
      1. Distinguishing between different causes of convexity defects
      2. Classifying hand gestures based on the number of extended fingers
    8. Summary
  8. Finding Objects via Feature Matching and Perspective Transforms
    1. Getting started
    2. Listing the tasks performed by the app
    3. Planning the app
    4. Setting up the app
      1. Running the app – the main() function routine
      2. Displaying results
    5. Understanding the process flow
    6. Learning feature extraction
      1. Looking at feature detection
      2. Detecting features in an image with SURF
      3. Obtaining feature descriptors with SURF
    7. Understanding feature matching
      1. Matching features across images with FLANN
      2. Testing the ratio for outlier removal
      3. Visualizing feature matches
      4. Mapping homography estimation
      5. Warping the image
    8. Learning feature tracking
      1. Understanding early outlier detection and rejection
    9. Seeing the algorithm in action
    10. Summary
    11. Attributions
  9. 3D Scene Reconstruction Using Structure from Motion
    1. Getting started
    2. Planning the app
    3. Learning about camera calibration
      1. Understanding the pinhole camera model
      2. Estimating the intrinsic camera parameters
        1. Defining the camera calibration GUI
        2. Initializing the algorithm
        3. Collecting image and object points
        4. Finding the camera matrix
    4. Setting up the app
      1. Understanding the main routine function
      2. Implementing the SceneReconstruction3D class
    5. Estimating the camera motion from a pair of images
      1. Applying point matching with rich feature descriptors
      2. Using point matching with optic flow
      3. Finding the camera matrices
      4. Applying image rectification
    6. Reconstructing the scene
    7. Understanding 3D point cloud visualization
    8. Learning about structure from motion
    9. Summary
  10. Using Computational Photography with OpenCV
    1. Getting started
    2. Planning the app
    3. Understanding the 8-bit problem
      1. Learning about RAW images
      2. Using gamma correction
    4. Understanding high-dynamic-range imaging
      1. Exploring ways to vary exposure
        1. Shutter speed
        2. Aperture
        3. ISO speed
      2. Generating HDR images using multiple exposure images
        1. Extracting exposure strength from images
        2. Estimating the camera response function
      3. Writing an HDR script using OpenCV
      4. Displaying HDR images
    5. Understanding panorama stitching
      1. Writing script arguments and filtering images
      2. Figuring out relative positions and the final picture size
        1. Finding camera parameters
        2. Creating the canvas for the panorama
        3. Blending the images together
      3. Improving panorama stitching
    6. Summary
    7. Further reading
    8. Attributions
  11. Tracking Visually Salient Objects
    1. Getting started
    2. Understanding visual saliency
    3. Planning the app
    4. Setting up the app
      1. Implementing the main function 
      2. Understanding the MultiObjectTracker class
    5. Mapping visual saliency
      1. Learning about Fourier analysis
      2. Understanding the natural scene statistics
      3. Generating a saliency map with the spectral residual approach
      4. Detecting proto-objects in a scene
    6. Understanding mean-shift tracking
      1. Automatically tracking all players on a soccer field
    7. ​Learning about the OpenCV Tracking API 
    8. Putting it all together
    9. Summary
    10. Dataset attribution
  12. Learning to Recognize Traffic Signs
    1. Getting started
    2. Planning the app
    3. Briefing on supervised learning concepts
      1. The training procedure
      2. The testing procedure
    4. Understanding the GTSRB dataset
      1. Parsing the dataset
    5. Learning about dataset feature extraction
      1. Understanding common preprocessing
      2. Learning about grayscale features
      3. Understanding color spaces
      4. Using SURF descriptor
      5. Mapping HOG descriptor
    6. Learning about SVMs
      1. Using SVMs for multiclass classification
      2. Training the SVM
      3. Testing the SVM
        1. Accuracy
        2. Confusion matrix
        3. Precision
        4. Recall
    7. Putting it all together
    8. Improving results with neural networks
    9. Summary
    10. Dataset attribution
  13. Learning to Recognize Facial Emotions
    1. Getting started
    2. Planning the app
    3. Learning about face detection
      1. Learning about Haar-based cascade classifiers
      2. Understanding pre-trained cascade classifiers
      3. Using a pre-trained cascade classifier
      4. Understanding the FaceDetector class
        1. Detecting faces in grayscale images
        2. Preprocessing detected faces
          1. Detecting the eyes
          2. Transforming the face
    4. Collecting data
      1. Assembling a training dataset
        1. Running the application
        2. Implementing the data collector GUI
          1. Augmenting the basic layout
          2. Processing the current frame
          3. Storing the data
    5. Understanding facial emotion recognition
      1. Processing the dataset
        1. Learning about PCA
      2. Understanding MLPs
        1. Understanding a perceptron
        2. Knowing about deep architectures
      3. Crafting an MLP for facial expression recognition
        1. Training the MLP
        2. Testing the MLP
        3. Running the script
    6. Putting it all together
    7. Summary
    8. Further reading
    9. Attributions
  14. Learning to Classify and Localize Objects
    1. Getting started
    2. Planning the app
    3. Preparing an inference script
    4. Preparing the dataset
      1. Downloading and parsing the dataset
      2. Creating a TensorFlow dataset 
    5. Classifying with CNNs
      1. Understanding CNNs
      2. Learning about transfer learning
      3. Preparing the pet type and breed classifier
      4. Training and evaluating the classifier
    6. Localizing with CNNs
      1. Preparing the model
      2. Understanding backpropagation
      3. Training the model
    7. Seeing inference in action
    8. Summary
    9. Dataset attribution
  15. Learning to Detect and Track Objects
    1. Getting started
    2. Planning the app
    3. Preparing the main script 
      1. Detecting objects with SSD
      2. Using other detectors
      3. Understanding object detectors
        1. The single-object detector
        2. The sliding-window approach
        3. Single-pass detectors
        4. Learning about Intersection over Union
      4. Training SSD- and YOLO-like networks 
      5. Tracking detected objects
    4. Implementing a Sort tracker
      1. Understanding the Kalman filter
      2. Using a box tracker with the Kalman filter
        1. Converting boundary boxes to observations
        2. Implementing a Kalman filter
      3. Associating detections with trackers
      4. Defining the main class of the tracker
    5. Seeing the app in action
    6. Summary
  16. Profiling and Accelerating Your Apps
    1. Accelerating with Numba
      1. Accelerating with the CPU
      2. Understanding Numba, CUDA, and GPU acceleration
  17. Setting Up a Docker Container
    1. Defining a Dockerfile
      1. Working with a GPU
  18. Other Books You May Enjoy
    1. Leave a review - let other readers know what you think
3.145.38.117