The OpenCV C++ reference manual is here: http: // docs. opencv. org . Use Quick Search to find descriptions of the particular functions and classes
Key OpenCV Classes
Point_
Point3_
Size_
Vec
Matx
Scalar
Rect
Range
Mat
SparseMat
Ptr
Template 2D point class
Template 3D point class
Template size (width, height) class
Template short vector class
Template small matrix class
4-element vector
Rectangle
Integer value range
2D or multi-dimensional dense array
(can be used to store matrices, images, histograms, feature descriptors, voxel volumes etc.)
Multi-dimensional sparse array
Template smart pointer class
Mat dyImage(image.size(), image.type()); for(int y = 1; y < image.rows-1; y++) {
Vec3b* prevRow = image.ptr(y-1);
Vec3b* nextRow = image.ptr(y+1); for(int x = 0; x < image.cols; x++) for(int c = 0; c < 3; c++) dyImage.at(y,x)[c] = saturate_cast( nextRow[x][c] - prevRow[x][c]);
}
Mat_::iterator it = image.begin(), itEnd = image.end(); for(; it != itEnd; ++it)
(*it)[1] ^= 255;
Matrix Manipulations: Copying,
Shuffling, Part Access
src.copyTo(dst)
Copy matrix to another one src.convertTo(dst,type,scale,shift) Scale and convert to another datatype
Matrix Basics
m.clone()
Make deep copy of a matrix
Create a matrix
m.reshape(nch,nrows) Change matrix dimensions and/or numMat image(240, 320, CV_8UC3); ber of channels without copying data
[Re]allocate a pre-declared matrix
m.row(i), m.col(i)
Take a matrix row/column image.create(480, 640, CV_8UC3);
m.rowRange(Range(i1,i2)) Take a matrix row/column span
Create a matrix initialized with a constant
m.colRange(Range(j1,j2))
Mat A33(3, 3, CV_32F, Scalar(5));
m.diag(i)
Take a matrix diagonal
Mat B33(3, 3, CV_32F); B33 = Scalar(5); m(Range(i1,i2),Range(j1,j2)),Take a submatrix
Mat C33 = Mat::ones(3, 3, CV_32F)*5.; m(roi) Mat D33 = Mat::zeros(3, 3, CV_32F) + 5.;
m.repeat(ny,nx)
Make a bigger matrix from a smaller one
Create a