看来这两年是离不开这个字眼儿了:port!

      最近自己在玩识别类的项目,发现OpenCV在Vision领域确实非常有号召力,但就是这么一个好东东,竟然对主流嵌入式系统没有太好的兼容性,不管是从软件架构上、还是接口通用性以及易用性上。要想把它使用在嵌入式平台上,必须搭载Linux或者WinCE平台上。If users want to directly utilize this library, they have to extract the part they need, which is totally time-consuming, cauze in order to do that they must familiarize the elements of OpenCV first, and each time a new application will be implemented, the work will have to be done repeatedly!

      So this kind of porting work should be tremendously meaningful! Knowing that, how could I dare to wait!

Step 1: Read:Learning OpenCV -- Gary Bradski and Adrian Kaehler

Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ix
1. Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . x. . . . . . . . 1
What Is OpenCV? 1
Who Uses OpenCV? 1
What Is Computer Vision? 2
The Origin of OpenCV 6
Downloading and Installing OpenCV 8
Getting the Latest OpenCV via CVS 10
More OpenCV Documentation 11
OpenCV Structure and Content 13

This figure does not include CvAux, which contains both defunct areas (embedded HMM
face recognition) and experimental algorithms (background/foreground segmentation).
CvAux is not particularly well documented in the Wiki and is not documented at all in
the …/opencv/docs subdirectory. CvAux covers:
Eigen objects, a computationally effi cient recognition technique t • hat is, in essence, a
template matching procedure
• 1D and 2D hidden Markov models, a statistical recognition technique solved by
dynamic programming
• Embedded HMMs (the observations of a parent HMM are themselves HMMs)

• rom stereo vision support
• Extensions to Delaunay triangulation, sequences, and so forth
• Stereo vision
• Shape matching with region contours
• Texture descriptors
• Eye and mouth tracking
• 3D tracking
• Finding skeletons (central lines) of objects in a scene
• Warping intermediate views between two camera views
• Background-foreground segmentation
• Video surveillance (see Wiki FAQ for more documentation)
• Camera calibration C++ classes (the C functions and engine are in CV)
Some of these features may migrate to CV in the future; others probably never will.

Portability 14
Exercises 15
2. Introduction to OpenCV . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
Getting Started 16
First Program—Display a Picture 16
Second Program—AVI Video 18
Moving Around 19
A Simple Transformation 22
A Not-So-Simple Transformation 24
Input from a Camera 26
Writing to an AVI File 27
Onward 29
Exercises 29

3. Getting to Know OpenCV . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
OpenCV Primitive Data Types 31
CvMat Matrix Structure 33
IplImage Data Structure 42
Matrix and Image Operators 47
Drawing Things 77
Data Persistence 82
Integrated Performance Primitives 86
Summary 87
Exercises 87
4. HighGUI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
A Portable Graphics Toolkit 90
Creating a Window 91
Loading an Image 92
Displaying Images 93
Working with Video 102
ConvertImage 106
Exercises 107
5. Image Processing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109
Overview 109
Smoothing 109
Image Morphology 115 
Flood Fill 124
Resize 129
Image Pyramids 130
Threshold 135
Exercises 141
6. Image Transforms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144
Overview 144
Convolution 144
Gradients and Sobel Derivatives 148
Laplace 150
Canny 151

Hough Transforms 153
Remap 162
Stretch, Shrink, Warp, and Rotate 163
CartToPolar and PolarToCart 172
LogPolar 174
Discrete Fourier Transform (DFT) 177
Discrete Cosine Transform (DCT) 182
Integral Images 182
Distance Transform 185
Histogram Equalization 186
Exercises 190
7. Histograms and Matching . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193 ====
Basic Histogram Data Structure 195
Accessing Histograms 198
Basic Manipulations with Histograms 199
Some More Complicated Stuff 206
Exercises 219
8. Contours . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 222
Memory Storage 222
Sequences 223
Contour Finding 234
Another Contour Example 243
More to Do with Contours 244
Matching Contours 251
Exercises 262
9. Image Parts and Segmentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 265
Parts and Segments 265
Background Subtraction 265
Watershed Algorithm 295
Image Repair by Inpainting 297
Mean-Shift Segmentation 298
Delaunay Triangulation, Voronoi Tesselation 300
Exercises 313

10. Tracking and Motion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 316
The Basics of Tracking 316
Corner Finding 316
Subpixel Corners 319
Invariant Features 321
Optical Flow 322
Mean-Shift and Camshift Tracking 337
Motion Templates 341
Estimators 348
The Condensation Algorithm 364
Exercises 367
11. Camera Models and Calibration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 370
Camera Model 371
Calibration 378
Undistortion 396
Putting Calibration All Together 397
Rodrigues Transform 401
Exercises 403
12. Projection and 3D Vision . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 405
Projections 405
Affine and Perspective Transformations 407
POSIT: 3D Pose Estimation 412
Stereo Imaging 415
Structure from Motion 453
Fitting Lines in Two and Three Dimensions 454
Exercises 458
13. Machine Learning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 459
What Is Machine Learning 459
Common Routines in the ML Library 471
Mahalanobis Distance 476
K-Means 479
Naïve/Normal Bayes Classifier 483
Binary Decision Trees 486
Boosting 495

Random Trees 501
Face Detection or Haar Classifier 506
Other Machine Learning Algorithms 516
Exercises 517
14. OpenCV’s Future . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 521
Past and Future 521
Directions 522
OpenCV for Artists 525
Afterword 526
Bibliography . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 527
Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 543