Gary Bradski, Adrian Kaehler0596516134, 978-0-596-51613-0
Table of contents :
Contents……Page 5
Purpose……Page 11
What This Book Is Not……Page 12
How This Book Is Best Used……Page 13
Conventions Used in This Book……Page 14
We’d Like to Hear from You……Page 15
Thanks for Help on OpenCV……Page 16
Gary Adds . . …….Page 17
Adrian Adds . . …….Page 18
Who Uses OpenCV?……Page 21
What Is Computer Vision?……Page 22
The Origin of OpenCV……Page 26
Speeding Up OpenCV with IPP……Page 27
Install……Page 28
Linux……Page 29
Getting the Latest OpenCV via CVS……Page 30
Documentation Available in HTML……Page 31
Documentation via the Wiki……Page 32
OpenCV Structure and Content……Page 33
Portability……Page 34
Exercises……Page 35
First Program—Display a Picture……Page 36
Second Program—AVI Video……Page 38
Moving Around……Page 39
A Simple Transformation……Page 42
A Not-So-Simple Transformation……Page 44
Input from a Camera……Page 46
Writing to an AVI File……Page 47
Exercises……Page 49
OpenCV Primitive Data Types……Page 51
Matrix and Image Types……Page 52
CvMat Matrix Structure……Page 53
The easy way……Page 56
The hard way……Page 57
The right way……Page 59
Arrays of Points……Page 60
IplImage Data Structure……Page 62
Accessing Image Data……Page 64
More on ROI and widthStep……Page 65
Matrix and Image Operators……Page 67
cvAbs, cvAbsDiff, and cvAbsDiffS……Page 69
cvAdd, cvAddS, cvAddWeighted, and alpha blending……Page 70
cvAnd and cvAndS……Page 72
cvAvgSdv……Page 73
cvCalcCovarMatrix……Page 74
cvCmp and cvCmpS……Page 75
cvConvertScale……Page 76
cvCrossProduct……Page 77
cvCvtColor……Page 78
cvDotProduct……Page 80
cvFlip……Page 81
cvGetCol and cvGetCols……Page 82
cvGetDims and cvGetDimSize……Page 83
cvGetSize……Page 84
cvInvert……Page 85
cvMax and cvMaxS……Page 86
cvMerge……Page 87
cvMul……Page 88
cvNorm……Page 89
cvNormalize……Page 90
cvReduce……Page 91
cvSet and cvSetZero……Page 92
cvSplit……Page 93
cvSum……Page 94
cvSVBkSb……Page 95
cvXor and cvXorS……Page 96
Lines……Page 97
Circles and Ellipses……Page 98
Polygons……Page 99
Fonts and Text……Page 100
Data Persistence……Page 102
Integrated Performance Primitives……Page 106
Exercises……Page 107
A Portable Graphics Toolkit……Page 110
Creating a Window……Page 111
Loading an Image……Page 112
Displaying Images……Page 113
Mouse Events……Page 115
Sliders, Trackbars, and Switches……Page 119
No Buttons……Page 121
Working with Video……Page 122
Reading Video……Page 123
Writing Video……Page 125
ConvertImage……Page 126
Exercises……Page 127
Smoothing……Page 129
Dilation and Erosion……Page 135
Making Your Own Kernel……Page 138
Opening and closing……Page 140
Morphological gradient……Page 141
Top Hat and Black Hat……Page 143
Flood Fill……Page 144
Resize……Page 149
Image Pyramids……Page 150
Threshold……Page 155
Adaptive Threshold……Page 158
Exercises……Page 161
Convolution……Page 164
Convolution Boundaries……Page 166
Gradients and Sobel Derivatives……Page 168
Laplace……Page 170
Canny……Page 171
Hough Line Transform……Page 173
Hough Circle Transform……Page 178
Remap……Page 182
Stretch, Shrink, Warp, and Rotate……Page 183
Dense affine transformations……Page 184
Computing the affine map matrix……Page 186
Perspective Transform……Page 189
Computing the perspective map matrix……Page 190
Sparse perspective transformations……Page 191
CartToPolar and PolarToCart……Page 192
LogPolar……Page 194
Discrete Fourier Transform (DFT)……Page 197
Spectrum Multiplication……Page 199
Convolution and DFT……Page 200
Integral Images……Page 202
Distance Transform……Page 205
Histogram Equalization……Page 206
Exercises……Page 210
CHAPTER 7: Histograms and Matching……Page 213
Basic Histogram Data Structure……Page 215
Accessing Histograms……Page 218
Basic Manipulations with Histograms……Page 219
Correlation (method = CV_COMP_CORREL)……Page 221
Bhattacharyya distance (method = CV_COMP_BHATTACHARYYA)……Page 222
Histogram Usage Examples……Page 223
Some More Complicated Stuff……Page 226
Earth Mover’s Distance……Page 227
Back Projection……Page 229
Patch-based back projection……Page 231
Template Matching……Page 234
Correlation matching methods (method = CV_TM_CCORR)……Page 235
Normalized methods……Page 236
Exercises……Page 239
Memory Storage……Page 242
Sequences……Page 243
Creating a Sequence……Page 244
Direct Access to Sequence Elements……Page 246
Slices, Copying, and Moving Data……Page 247
Using a Sequence As a Stack……Page 249
Sequence Readers and Sequence Writers……Page 251
Sequences and Arrays……Page 253
Contour Finding……Page 254
Contours Are Sequences……Page 258
Freeman Chain Codes……Page 260
Drawing Contours……Page 261
A Contour Example……Page 262
Another Contour Example……Page 263
More to Do with Contours……Page 264
Polygon Approximations……Page 265
Length……Page 267
Bounding boxes……Page 268
Enclosing circles and ellipses……Page 269
Geometry……Page 270
Matching Contours……Page 271
Moments……Page 272
More About Moments……Page 273
Matching with Hu Moments……Page 275
Hierarchical Matching……Page 276
Contour Convexity and Convexity Defects……Page 278
Pairwise Geometrical Histograms……Page 281
Exercises……Page 282
Background Subtraction……Page 285
Weaknesses of Background Subtraction……Page 286
A Slice of Pixels……Page 287
Frame Differencing……Page 290
Averaging Background Method……Page 291
Accumulating means, variances, and covariances……Page 296
Advanced Background Method……Page 298
Learning the background……Page 301
Learning with moving foreground objects……Page 304
Background differencing: Finding foreground objects……Page 305
Connected Components for Foreground Cleanup……Page 307
A quick test……Page 312
Comparing Background Methods……Page 314
Watershed Algorithm……Page 315
Image Repair by Inpainting……Page 317
Mean-Shift Segmentation……Page 318
Delaunay Triangulation, Voronoi Tesselation……Page 320
Creating a Delaunay or Voronoi Subdivision……Page 323
Navigating Delaunay Subdivisions……Page 324
Walking on edges……Page 326
Points from edges……Page 328
Method 2: Step through a sequence of points or edges……Page 329
Usage Examples……Page 330
Exercises……Page 333
Corner Finding……Page 336
Subpixel Corners……Page 339
Invariant Features……Page 341
Optical Flow……Page 342
Lucas-Kanade Method……Page 343
How Lucas-Kanade works……Page 344
Pyramid Lucas-Kanade code……Page 349
Dense Tracking Techniques……Page 354
Horn-Schunck method……Page 355
Block matching method……Page 356
Mean-Shift……Page 357
Motion Templates……Page 361
Estimators……Page 368
The Kalman Filter……Page 370
Some Kalman math……Page 371
Systems with dynamics……Page 373
Kalman equations……Page 375
OpenCV and the Kalman filter……Page 378
Kalman filter example code……Page 379
A Brief Note on the Extended Kalman Filter……Page 383
The Condensation Algorithm……Page 384
Exercises……Page 387
CHAPTER 11: Camera Models and Calibration……Page 390
Camera Model……Page 391
Basic Projective Geometry……Page 393
Lens Distortions……Page 395
Calibration……Page 398
Rotation Matrix and Translation Vector……Page 399
Chessboards……Page 401
Drawing chessboard corners……Page 403
Homography……Page 404
Camera Calibration……Page 407
How many chess corners for how many parameters?……Page 408
What’s under the hood?……Page 409
Calibration function……Page 412
Computing extrinsics only……Page 415
Undistortion……Page 416
Putting Calibration All Together……Page 417
Rodrigues Transform……Page 421
Exercises……Page 423
Projections……Page 425
Affine and Perspective Transformations……Page 427
Bird’s-Eye View Transform Example……Page 428
POSIT: 3D Pose Estimation……Page 432
Triangulation……Page 435
Epipolar Geometry……Page 439
The Essential and Fundamental Matrices……Page 441
Essential matrix math……Page 442
Fundamental matrix math……Page 443
How OpenCV handles all of this……Page 444
Computing Epipolar Lines……Page 446
Stereo Calibration……Page 447
Stereo Rectification……Page 450
Uncalibrated stereo rectification: Hartley’s algorithm……Page 451
Calibrated stereo rectification: Bouguet’s algorithm……Page 453
Rectification map……Page 456
Stereo Correspondence……Page 458
Stereo Calibration, Rectification, and Correspondence Code……Page 465
Depth Maps from 3D Reprojection……Page 472
Structure from Motion……Page 473
Fitting Lines in Two and Three Dimensions……Page 474
Exercises……Page 478
Training and Test Set……Page 479
Supervised and Unsupervised Data……Page 480
Generative and Discriminative Models……Page 481
OpenCV ML Algorithms……Page 482
Using Machine Learning in Vision……Page 483
Variable Importance……Page 485
Diagnosing Machine Learning Problems……Page 486
Cross-validation, bootstrapping, ROC curves, and confusion matrices……Page 489
Common Routines in the ML Library……Page 491
Training……Page 492
Controlling Training Iterations……Page 495
Mahalanobis Distance……Page 496
Problems and Solutions……Page 499
K-Means Code……Page 501
Naïve/Normal Bayes Classifier……Page 503
Naïve/Normal Bayes Code……Page 505
Classification Impurity……Page 506
Decision Tree Usage……Page 507
Training the tree……Page 508
Decision Tree Results……Page 512
Boosting……Page 515
AdaBoost……Page 517
Boosting Code……Page 518
Random Trees……Page 521
Random Tree Code……Page 522
Using Random Trees……Page 525
Face Detection or Haar Classifier……Page 526
Boosting in the Haar cascade……Page 527
Viola-Jones Classifier Theory……Page 528
Works well on . . …….Page 529
Code for Detecting Faces……Page 531
Learning New Objects……Page 533
K-Nearest Neighbors……Page 536
Exercises……Page 537
Past and Future……Page 541
Directions……Page 542
Specific Items……Page 544
OpenCV for Artists……Page 545
Afterword……Page 546
Bibliography……Page 547
Index……Page 563
Colophon……Page 577
Reviews
There are no reviews yet.