Log In
Or create an account ->
Imperial Library
Home
About
News
Upload
Forum
Help
Login/SignUp
Index
Learning OpenCV
SPECIAL OFFER: Upgrade this ebook with O’Reilly
A Note Regarding Supplemental Files
Preface
Purpose
Who This Book Is For
What This Book Is Not
About the Programs in This Book
Prerequisites
How This Book Is Best Used
Conventions Used in This Book
Using Code Examples
Safari® Books Online
We'd Like to Hear from You
Acknowledgments
Thanks for Help on OpenCV
Thanks for Help on the Book
Gary Adds…
Adrian Adds…
1. Overview
What Is OpenCV?
Who Uses OpenCV?
What Is Computer Vision?
The Origin of OpenCV
Speeding Up OpenCV with IPP
Who Owns OpenCV?
Downloading and Installing OpenCV
Install
Windows
Linux
MacOS X
Getting the Latest OpenCV via CVS
More OpenCV Documentation
Documentation Available in HTML
Documentation via the Wiki
OpenCV Structure and Content
Portability
Exercises
2. Introduction to OpenCV
Getting Started
First Program—Display a Picture
Second Program—AVI Video
Moving Around
A Simple Transformation
A Not-So-Simple Transformation
Input from a Camera
Writing to an AVI File
Onward
Exercises
3. Getting to Know OpenCV
OpenCV Primitive Data Types
Matrix and Image Types
CvMat Matrix Structure
Accessing Data in Your Matrix
The easy way
The hard way
The right way
Arrays of Points
IplImage Data Structure
Accessing Image Data
More on ROI and widthStep
Matrix and Image Operators
Matrix and Image Operators
cvAbs, cvAbsDiff, and cvAbsDiffS
cvAdd, cvAddS, cvAddWeighted, and alpha blending
cvAnd and cvAndS
cvAvg
cvAvgSdv
cvCalcCovarMatrix
cvCmp and cvCmpS
cvConvertScale
cvConvertScaleAbs
cvCopy
cvCountNonZero
cvCrossProduct
cvCvtColor
cvDet
cvDiv
cvDotProduct
cvEigenVV
cvFlip
cvGEMM
cvGetCol and cvGetCols
cvGetDiag
cvGetDims and cvGetDimSize
cvGetRow and cvGetRows
cvGetSize
cvGetSubRect
cvInRange and cvInRangeS
cvInvert
cvMahalanobis
cvMax and cvMaxS
cvMerge
cvMin and cvMinS
cvMinMaxLoc
cvMul
cvNot
cvNorm
cvNormalize
cvOr and cvOrS
cvReduce
cvRepeat
cvScale
cvSet and cvSetZero
cvSetIdentity
cvSolve
cvSplit
cvSub, cvSubS, and cvSubRS
cvSum
cvSVD
cvSVBkSb
cvTrace
cvTranspose and cvT
cvXor and cvXorS
cvZero
Drawing Things
Lines
Circles and Ellipses
Polygons
Fonts and Text
Data Persistence
Integrated Performance Primitives
Verifying Installation
Summary
Exercises
4. HighGUI
A Portable Graphics Toolkit
Creating a Window
Loading an Image
Displaying Images
WaitKey
Mouse Events
Sliders, Trackbars, and Switches
No Buttons
Working with Video
Reading Video
Writing Video
ConvertImage
Exercises
5. Image Processing
Overview
Smoothing
Image Morphology
Dilation and Erosion
Making Your Own Kernel
More General Morphology
Opening and closing
Morphological gradient
Top Hat and Black Hat
Flood Fill
Resize
Image Pyramids
Threshold
Adaptive Threshold
Exercises
6. Image Transforms
Overview
Convolution
Convolution Boundaries
Gradients and Sobel Derivatives
Scharr Filter
Laplace
Canny
Hough Transforms
Hough Line Transform
Hough Circle Transform
Remap
Stretch, Shrink, Warp, and Rotate
Affine Transform
Dense affine transformations
cvWarpAffine performance
Computing the affine map matrix
Sparse affine transformations
Perspective Transform
Dense perspective transform
Computing the perspective map matrix
Sparse perspective transformations
CartToPolar and PolarToCart
LogPolar
Discrete Fourier Transform (DFT)
Spectrum Multiplication
Convolution and DFT
Discrete Cosine Transform (DCT)
Integral Images
Distance Transform
Histogram Equalization
Exercises
7. Histograms and Matching
Basic Histogram Data Structure
Accessing Histograms
Basic Manipulations with Histograms
Comparing Two Histograms
Correlation (method = CV_COMP_CORREL)
Chi-square (method = CV_COMP_CHISQR)
Intersection (method = CV_COMP_INTERSECT)
Bhattacharyya distance (method = CV_COMP_BHATTACHARYYA)
Histogram Usage Examples
Some More Complicated Stuff
Earth Mover's Distance
Back Projection
Patch-based back projection
Template Matching
Square difference matching method (method = CV_TM_SQDIFF)
Correlation matching methods (method = CV_TM_CCORR)
Correlation coefficient matching methods (method = CV_TM_CCOEFF)
Normalized methods
Exercises
8. Contours
Memory Storage
Sequences
Creating a Sequence
Deleting a Sequence
Direct Access to Sequence Elements
Slices, Copying, and Moving Data
Using a Sequence As a Stack
Inserting and Removing Elements
Sequence Block Size
Sequence Readers and Sequence Writers
Sequences and Arrays
Contour Finding
Contours Are Sequences
Freeman Chain Codes
Drawing Contours
A Contour Example
Another Contour Example
More to Do with Contours
Polygon Approximations
Summary Characteristics
Length
Bounding boxes
Enclosing circles and ellipses
Geometry
Matching Contours
Moments
More About Moments
Matching with Hu Moments
Hierarchical Matching
Contour Convexity and Convexity Defects
Pairwise Geometrical Histograms
Exercises
9. Image Parts and Segmentation
Parts and Segments
Background Subtraction
Weaknesses of Background Subtraction
Scene Modeling
A Slice of Pixels
Frame Differencing
Averaging Background Method
Accumulating means, variances, and covariances
Advanced Background Method
Structures
Learning the background
Learning with moving foreground objects
Background differencing: Finding foreground objects
Using the codebook background model
A few more thoughts on codebook models
Connected Components for Foreground Cleanup
A quick test
Comparing Background Methods
Watershed Algorithm
Image Repair by Inpainting
Mean-Shift Segmentation
Delaunay Triangulation, Voronoi Tesselation
Creating a Delaunay or Voronoi Subdivision
Navigating Delaunay Subdivisions
Walking on edges
Points from edges
Method 1: Use an external point to locate an edge or vertex
Method 2: Step through a sequence of points or edges
Identifying the bounding triangle or edges on the convex hull and walking the hull
Usage Examples
Exercises
10. Tracking and Motion
The Basics of Tracking
Corner Finding
Subpixel Corners
Invariant Features
Optical Flow
Lucas-Kanade Method
How Lucas-Kanade works
Lucas-Kanade code
Pyramid Lucas-Kanade code
Dense Tracking Techniques
Horn-Schunck method
Block matching method
Mean-Shift and Camshift Tracking
Mean-Shift and Camshift Tracking
Mean-Shift
Camshift
Motion Templates
Estimators
The Kalman Filter
Some Kalman math
Systems with dynamics
Kalman equations
OpenCV and the Kalman filter
Kalman filter example code
A Brief Note on the Extended Kalman Filter
The Condensation Algorithm
Exercises
11. Camera Models and Calibration
Camera Model
Basic Projective Geometry
Lens Distortions
Calibration
Rotation Matrix and Translation Vector
Chessboards
Subpixel corners
Drawing chessboard corners
Homography
Camera Calibration
How many chess corners for how many parameters?
What's under the hood?
Calibration function
Computing extrinsics only
Undistortion
Putting Calibration All Together
Rodrigues Transform
Exercises
12. Projection and 3D Vision
Projections
Affine and Perspective Transformations
Bird's-Eye View Transform Example
POSIT: 3D Pose Estimation
Stereo Imaging
Triangulation
Epipolar Geometry
The Essential and Fundamental Matrices
Essential matrix math
Fundamental matrix math
How OpenCV handles all of this
Computing Epipolar Lines
Stereo Calibration
Stereo Rectification
Uncalibrated stereo rectification: Hartley's algorithm
Calibrated stereo rectification: Bouguet's algorithm
Rectification map
Stereo Correspondence
Stereo Calibration, Rectification, and Correspondence Code
Depth Maps from 3D Reprojection
Structure from Motion
Fitting Lines in Two and Three Dimensions
Exercises
13. Machine Learning
What Is Machine Learning
Training and Test Set
Supervised and Unsupervised Data
Generative and Discriminative Models
OpenCV ML Algorithms
Using Machine Learning in Vision
Variable Importance
Diagnosing Machine Learning Problems
Cross-validation, bootstrapping, ROC curves, and confusion matrices
Common Routines in the ML Library
Training
Prediction
Controlling Training Iterations
Mahalanobis Distance
K-Means
Problems and Solutions
K-Means Code
Naïve/Normal Bayes Classifier
Naïve/Normal Bayes Code
Binary Decision Trees
Regression Impurity
Classification Impurity
Entropy impurity
Gini impurity
Misclassification impurity
Decision Tree Usage
Training the tree
Decision Tree Results
Boosting
AdaBoost
Boosting Code
Random Trees
Random Tree Code
Using Random Trees
Face Detection or Haar Classifier
Supervised Learning and Boosting Theory
Boosting in the Haar cascade
Viola-Jones Classifier Theory
Works well on …
Code for Detecting Faces
Learning New Objects
Other Machine Learning Algorithms
Expectation Maximization
K-Nearest Neighbors
Multilayer Perceptron
Support Vector Machine
Exercises
14. OpenCV's Future
Past and Future
Directions
Specific Items
OpenCV for Artists
Afterword
15. Bibliography
Index
About the Authors
Colophon
SPECIAL OFFER: Upgrade this ebook with O’Reilly
← Prev
Back
Next →
← Prev
Back
Next →