Escolar Documentos
Profissional Documentos
Cultura Documentos
Goals
Develop a universal toolbox for research
and development in the field of Computer
Vision
Features
Image data manipulation
allocation, release, copying, setting, conversion
Features (cont.)
Structural analysis
connected components, contour processing, distance transform,
various moments, template matching, Hough transform, polygonal
approximation, line fitting, ellipse fitting, Delaunay triangulation
Camera calibration
finding and tracking calibration patterns, calibration, fundamental
matrix estimation, homography estimation, stereo correspondence
Motion analysis
optical flow, motion segmentation, tracking
Object recognition
eigen-methods, HMM
Basic GUI
display image/video, keyboard and mouse handling, scroll-bars
Image labeling
line, conic, polygon, text drawing
Modules
OpenCV Functionality
more than 350 algorithms
Cxcore
Data structures and linear algebra support.
cv
Main OpenCV functions.
Cvaux
Auxiliary (experimental) OpenCV functions.
Highgui
GUI functions.
5
Toturial
http://nchc.dl.sourceforge.net/sourceforge/opencvlibra
ry/ippocv.pdf
7
System requirement
Platforms:
Win9x/WinNT/Win2000
C++ Compiler (Visual C++ 6.0,Intel C++
Compiler 5.x,Borland C++ 5.5, Mingw GNU
C/C++ 2.95.3 are included ) for core libraries
Matlab
Visual C++ to build the most of demos
Settings- An example in VC
Library: project->setting->link
cv.lib cvaux.lib highgui.lib cxcore.lib
Directories
Include
C:\PROGRAM FILES\OPENCV\CV\INCLUDE
C:\PROGRAM FILES\OPENCV\CVAUX\INCLUDE
C:\PROGRAM FILES\OPENCV\OTHERLIBS\HIGHGUI
C:\PROGRAM FILES\OPENCV\CXCORE\INCLUDE
Library
C:\PROGRAM FILES\OPENCV\LIB
FilePathName
C:\PROGRAM FILES\OPENCV\bin
Include in programs
#include "cv.h, "cvaux.h, "highgui.h, "cxcore.h"
9
Todays outline
Basic structures
Operations on arrays
Dynamic structures
Drawing functions
Miscellaneous functions
Error handling
11
Usage
CvPoint P1;
P1.x = 10;
P1.y = 2;
CvSize2D32f
CvRect
offset and size of a rectangle
CvScalar
a container for 1-, 2-, 3- or 4-tuples of numbers
13
CvArr
Arbitrary array
CvMat, IplImage, CvSeq
14
CvMat
typedef struct CvMat {
int type; /* CvMat signature (CV_MAT_MAGIC_VAL), element type and flags */
int step; /* full row length in bytes */
int* refcount; /* underlying data reference counter */
union {
uchar* ptr;
short* s;
int* i;
float* fl;
double* db;
} data; /* data pointers */
#ifdef __cplusplus
union {
int rows;
int height;
};
union {
int cols;
int width;
};
#else
int rows; /* number of rows */
int cols; /* number of columns */
#endif
} CvMat;
CvMatND, CvSparseMat
15
cvCreateMat(2, 2, CV_32F);
0, 0, cvScalar(1));
0, 1, cvScalar(2));
1, 0, cvScalar(3));
1, 1, cvScalar(4));
1 2
M
3 4
i = cvGet2D(M, 0, 0).val[0];
j = cvGet2D(M, 0, 1).val[0];
i = 1, j = 2.
cvReleaseMat(&M);
16
17
18
19
SetImageROI
void cvSetImageROI( IplImage* image, CvRect rect );
GetImageROI
CvRect cvGetImageROI( const IplImage* image );
20
ReleaseMat
21
CvMat* cvReshape( const CvArr* arr, CvMat* header, int new_cn, int new_rows=0 );
22
23
bottom
free_space
top
24
26
27
Operations of CvSeq
28
CvGraph
Oriented or unoriented weigted graph
CV_TREE_NODE_FIELDS
For a tree node type declaration
29
Drawing functions
CV_RGB, cvLine, cvRectangle, cvCircle,
cvEllipse, cvFillPoly, cvFillConvexPoly,
cvPolyLine, cvDrawContours.
cvInitFont, cvPutText, cvGetTextSize.
30
Miscellaneous functions
cvKMeans2()
Splits set of vectors by given number of
clusters
void cvKMeans2( const CvArr* samples, int
cluster_count, CvArr* labels,
CvTermCriteria termcrit );
31
Example of KMeans2
C-code
32
33
34
35