Home Page Icon
Home Page
Table of Contents for
OpenCV: Computer Vision Projects with Python
Close
OpenCV: Computer Vision Projects with Python
by Michael Beyeler, Prateek Joshi, Joseph Howse
OpenCV: Computer Vision Projects with Python
OpenCV: Computer Vision Projects with Python
Table of Contents
OpenCV: Computer Vision Projects with Python
OpenCV: Computer Vision Projects with Python
Credits
Preface
What this learning path covers
What you need for this learning path
Who this learning path is for
Reader feedback
Customer support
Downloading the example code
Errata
Piracy
Questions
1. Module 1
1. Setting up OpenCV
Choosing and using the right setup tools
Making the choice on Windows XP, Windows Vista, Windows 7, or Windows 8
Using binary installers (no support for depth cameras)
Using CMake and compilers
Making the choice on Mac OS X Snow Leopard, Mac OS X Lion, or Mac OS X Mountain Lion
Using MacPorts with ready-made packages
Using MacPorts with your own custom packages
Using Homebrew with ready-made packages (no support for depth cameras)
Using Homebrew with your own custom packages
Making the choice on Ubuntu 12.04 LTS or Ubuntu 12.10
Using the Ubuntu repository (no support for depth cameras)
Using CMake via a ready-made script that you may customize
Making the choice on other Unix-like systems
Running samples
Finding documentation, help, and updates
Summary
2. Handling Files, Cameras, and GUIs
Basic I/O scripts
Reading/Writing an image file
Converting between an image and raw bytes
Reading/Writing a video file
Capturing camera frames
Displaying camera frames in a window
Project concept
An object-oriented design
Abstracting a video stream – managers.CaptureManager
Abstracting a window and keyboard – managers.WindowManager
Applying everything – cameo.Cameo
Summary
3. Filtering Images
Creating modules
Channel mixing – seeing in Technicolor
Simulating RC color space
Simulating RGV color space
Simulating CMV color space
Curves – bending color space
Formulating a curve
Caching and applying a curve
Designing object-oriented curve filters
Emulating photo films
Emulating Kodak Portra
Emulating Fuji Provia
Emulating Fuji Velvia
Emulating cross-processing
Highlighting edges
Custom kernels – getting convoluted
Modifying the application
Summary
4. Tracking Faces with Haar Cascades
Conceptualizing Haar cascades
Getting Haar cascade data
Creating modules
Defining a face as a hierarchy of rectangles
Tracing, cutting, and pasting rectangles
Adding more utility functions
Tracking faces
Modifying the application
Swapping faces in one camera feed
Copying faces between camera feeds
Summary
5. Detecting Foreground/Background Regions and Depth
Creating modules
Capturing frames from a depth camera
Creating a mask from a disparity map
Masking a copy operation
Modifying the application
Summary
A. Integrating with Pygame
Installing Pygame
Documentation and tutorials
Subclassing managers.WindowManager
Modifying the application
Further uses of Pygame
Summary
B. Generating Haar Cascades for Custom Targets
Gathering positive and negative training images
Finding the training executables
On Windows
On Mac, Ubuntu, and other Unix-like systems
Creating the training sets and cascade
Creating <negative_description>
Creating <positive_description>
Creating <binary_description> by running <opencv_createsamples>
Creating <cascade> by running <opencv_traincascade>
Testing and improving <cascade>
Summary
2. Module 2
1. Detecting Edges and Applying Image Filters
2D convolution
Blurring
The size of the kernel versus the blurriness
Edge detection
Motion blur
Under the hood
Sharpening
Understanding the pattern
Embossing
Erosion and dilation
Afterthought
Creating a vignette filter
What's happening underneath?
How do we move the focus around?
Enhancing the contrast in an image
How do we handle color images?
Summary
2. Cartoonizing an Image
Accessing the webcam
Under the hood
Keyboard inputs
Interacting with the application
Mouse inputs
What's happening underneath?
Interacting with a live video stream
How did we do it?
Cartoonizing an image
Deconstructing the code
Summary
3. Detecting and Tracking Different Body Parts
Using Haar cascades to detect things
What are integral images?
Detecting and tracking faces
Understanding it better
Fun with faces
Under the hood
Detecting eyes
Afterthought
Fun with eyes
Positioning the sunglasses
Detecting ears
Detecting a mouth
It's time for a moustache
Detecting a nose
Detecting pupils
Deconstructing the code
Summary
4. Extracting Features from an Image
Why do we care about keypoints?
What are keypoints?
Detecting the corners
Good Features To Track
Scale Invariant Feature Transform (SIFT)
Speeded Up Robust Features (SURF)
Features from Accelerated Segment Test (FAST)
Binary Robust Independent Elementary Features (BRIEF)
Oriented FAST and Rotated BRIEF (ORB)
Summary
5. Creating a Panoramic Image
Matching keypoint descriptors
How did we match the keypoints?
Understanding the matcher object
Drawing the matching keypoints
Creating the panoramic image
Finding the overlapping regions
Stitching the images
What if the images are at an angle to each other?
Why does it look stretched?
Summary
6. Seam Carving
Why do we care about seam carving?
How does it work?
How do we define "interesting"?
How do we compute the seams?
Can we expand an image?
Can we remove an object completely?
How did we do it?
Summary
7. Detecting Shapes and Segmenting an Image
Contour analysis and shape matching
Approximating a contour
Identifying the pizza with the slice taken out
How to censor a shape?
What is image segmentation?
How does it work?
Watershed algorithm
Summary
8. Object Tracking
Frame differencing
Colorspace based tracking
Building an interactive object tracker
Feature based tracking
Background subtraction
Summary
9. Object Recognition
Object detection versus object recognition
What is a dense feature detector?
What is a visual dictionary?
What is supervised and unsupervised learning?
What are Support Vector Machines?
What if we cannot separate the data with simple straight lines?
How do we actually implement this?
What happened inside the code?
How did we build the trainer?
Summary
10. Stereo Vision and 3D Reconstruction
What is stereo correspondence?
What is epipolar geometry?
Why are the lines different as compared to SIFT?
Building the 3D map
Summary
11. Augmented Reality
What is the premise of augmented reality?
What does an augmented reality system look like?
Geometric transformations for augmented reality
What is pose estimation?
How to track planar objects?
What happened inside the code?
How to augment our reality?
Mapping coordinates from 3D to 2D
How to overlay 3D objects on a video?
Let's look at the code
Let's add some movements
Summary
3. Module 3
1. Fun with Filters
Planning the app
Creating a black-and-white pencil sketch
Implementing dodging and burning in OpenCV
Pencil sketch transformation
Generating a warming/cooling filter
Color manipulation via curve shifting
Implementing a curve filter by using lookup tables
Designing the warming/cooling effect
Cartoonizing an image
Using a bilateral filter for edge-aware smoothing
Detecting and emphasizing prominent edges
Combining colors and outlines to produce a cartoon
Putting it all together
Running the app
The GUI base class
The GUI constructor
Handling video streams
A basic GUI layout
A custom filter layout
Summary
2. Hand Gesture Recognition Using a Kinect Depth Sensor
Planning the app
Setting up the app
Accessing the Kinect 3D sensor
Running the app
The Kinect GUI
Tracking hand gestures in real time
Hand region segmentation
Finding the most prominent depth of the image center region
Applying morphological closing to smoothen the segmentation mask
Finding connected components in a segmentation mask
Hand shape analysis
Determining the contour of the segmented hand region
Finding the convex hull of a contour area
Finding the convexity defects of a convex hull
Hand gesture recognition
Distinguishing between different causes of convexity defects
Classifying hand gestures based on the number of extended fingers
Summary
3. Finding Objects via Feature Matching and Perspective Transforms
Tasks performed by the app
Planning the app
Setting up the app
Running the app
The FeatureMatching GUI
The process flow
Feature extraction
Feature detection
Detecting features in an image with SURF
Feature matching
Matching features across images with FLANN
The ratio test for outlier removal
Visualizing feature matches
Homography estimation
Warping the image
Feature tracking
Early outlier detection and rejection
Seeing the algorithm in action
Summary
4. 3D Scene Reconstruction Using Structure from Motion
Planning the app
Camera calibration
The pinhole camera model
Estimating the intrinsic camera parameters
The camera calibration GUI
Initializing the algorithm
Collecting image and object points
Finding the camera matrix
Setting up the app
The main function routine
The SceneReconstruction3D class
Estimating the camera motion from a pair of images
Point matching using rich feature descriptors
Point matching using optic flow
Finding the camera matrices
Image rectification
Reconstructing the scene
3D point cloud visualization
Summary
5. Tracking Visually Salient Objects
Planning the app
Setting up the app
The main function routine
The Saliency class
The MultiObjectTracker class
Visual saliency
Fourier analysis
Natural scene statistics
Generating a Saliency map with the spectral residual approach
Detecting proto-objects in a scene
Mean-shift tracking
Automatically tracking all players on a soccer field
Extracting bounding boxes for proto-objects
Setting up the necessary bookkeeping for mean-shift tracking
Tracking objects with the mean-shift algorithm
Putting it all together
Summary
6. Learning to Recognize Traffic Signs
Planning the app
Supervised learning
The training procedure
The testing procedure
A classifier base class
The GTSRB dataset
Parsing the dataset
Feature extraction
Common preprocessing
Grayscale features
Color spaces
Speeded Up Robust Features
Histogram of Oriented Gradients
Support Vector Machine
Using SVMs for Multi-class classification
Training the SVM
Testing the SVM
Confusion matrix
Accuracy
Precision
Recall
Putting it all together
Summary
7. Learning to Recognize Emotions on Faces
Planning the app
Face detection
Haar-based cascade classifiers
Pre-trained cascade classifiers
Using a pre-trained cascade classifier
The FaceDetector class
Detecting faces in grayscale images
Preprocessing detected faces
Facial expression recognition
Assembling a training set
Running the screen capture
The GUI constructor
The GUI layout
Processing the current frame
Adding a training sample to the training set
Dumping the complete training set to a file
Feature extraction
Preprocessing the dataset
Principal component analysis
Multi-layer perceptrons
The perceptron
Deep architectures
An MLP for facial expression recognition
Training the MLP
Testing the MLP
Running the script
Putting it all together
Summary
A. Bibliography
Index
Search in book...
Toggle Font Controls
Playlists
Add To
Create new playlist
Name your new playlist
Playlist description (optional)
Cancel
Create playlist
Sign In
Email address
Password
Forgot Password?
Create account
Login
or
Continue with Facebook
Continue with Google
Sign Up
Full Name
Email address
Confirm Email Address
Password
Login
Create account
or
Continue with Facebook
Continue with Google
Prev
Previous Chapter
Table of Contents
Next
Next Chapter
OpenCV: Computer Vision Projects with Python
OpenCV: Computer Vision Projects with Python
Add Highlight
No Comment
..................Content has been hidden....................
You can't read the all page of ebook, please click
here
login for view all page.
Day Mode
Cloud Mode
Night Mode
Reset