C++版本的好处:
1、在于可以尽量避免使用指针这种危险的东西;
2、不用费心去release资源了,因为在其destructor里面,系统会自动帮你搞定。
3、在某些情况下会比C版本运行速度快。
在文件中包含 using namespace cv;
Imread(CvLoadImage):loads an image from a file;
imshow(cvShowImage):displays an image in the specifiedwidow;
waitKey(cvWaitKey):waits for a pressed key;
cvtColor(cvCvtColor):converts an image from one colorspace to another;
reduce(cvReduce):reduces a matrix to a vector;
minMaxLoc(cvMinMaxLoc):finds the global minimum andmaximum in a whole array or sub-array;
namedWindow(cvNamedWindow):creates a window;
destroyWindow(cvDestroyWindow):destroys a window;
destroyAllWindows(cvDestroyAllWindows):destroys all of the HighGUIwindows;
imwrite(cvSaveImage):saves an image to a specified file;
resize(cvResize):resizes an image;
pyrDown(cvPyrDown):blurs an image and downsamples it;
pyrUp(cvPyrUp):upsamples an image and then blursit;
threshold(cvThreshold):applies a fixed-level threshold toeach array element;
adaptiveThreshold(cvAdaptiveThreshold):applies an adaptive threshold toan array;
VideoCapthure::open(cvCaptureFromFile):open video file or a capturingdevice for video capturing;
VideoCapture::isOpened:returns true if video capturinghas been initialized already;
VideoCapture::release(cvReleaseCapture):closes video file or capturingdevice;
VideoCapture::grab(cvGrabFrame):grabs the next frame from videofile or capturing device;
VideoCaputre::retrieve(cvRetrieveFrame):decodes and returns the grabbedvideo frame;
VideoCapture::read(cvQueryFrame):grabs,decodes and returns the nextvideo frame;
VideoCapture::get(cvGetCaptureProperty):returns the specified VideoCaptureproperty;
VideoCapture::set(cvSetCaptureProperty):sets a property in theVideoCapture;
VideoWriter::open:initializes or reinitializes videowriter;
VideoWriter::isOpened:returns true if video writer hasbeen successfully initialized;
VideoWriter::write:writes the next video frame;
Mat::row:creates a matrix header for thespecified matrix row;
Mat::col:creates a matrix header for thespecified matrix column;
Mat::rowRange:creates a matrix header for thespecified row span;
Mat::colRange:creates a matrix header for thespecified col span;
Mat::diag:extracts a diagonal from a matrix,or creates a diagonal matrix;
Mat::clone:creates a full copy of the arrayand the underlying data;
Mat::copyTo(cvCopy):copies the matrix to another one;
Mat::convertTo(cvConvertScale):converts an array to anotherdatatype with optional scaling;
Mat::assignTo:provides a functional form ofconvertTo;
Mat::setTo:sets all or some of the arrayelements to the specified value;
Mat::reshape:changes the shape and/or thenumber of channels of a 2D matrix without copying the data;
Mat::t:transposes a matrix;
Mat::inv:inverses a matrix;
Mat::mul:performs an element-wisemultiplication or division of the two matrices;
Mat::cross:computes a cross-product of two3-element vectors;
Mat::dot:computes a dot-product of twovectors;
Mat::zeros:returns a zero array of thespecified size and type;
Mat::ones:returns an array of all 1’s of thespecified size and type;
Mat::eye:returns an identity matrix of thespecified size and type;
Mat::create:allocates new array data if needed;
Mat::addref:increments the reference counter;
Mat::release:decrements the reference counterand deallocates the matrix if needed;
Mat::resize:changes the number of matrix rows;
Mat::reserve:reserves space for the certainnumber of rows;
Mat::push_back:adds elements to the bottom of thematrix;
Mat::pop_back:removes elements from the bottomof the matrix;
Mat::locateROI:locates the matrix header within aparent matrix;
Mat::adjustROI:adjusts a submatrix size andposition within the parent matrix;
Mat::operator:extracts a rectangular submatrix;
Mat::operatorCvMat:creates the CvMat header for thematrix;
Mat::operatorIplImage:creates the IplImage header forthe matrix;
Mat::total:returns the total number fo arrayelements;
Mat::isContinuous:reports whether the matrix iscontinuous or not;
Mat::elemSize:returns the matrix element size inbytes;
Mat::elemSize1:returns the size of each matrixelement channel in bytes;
Mat::type:returns the type of a matrixelement;
Mat::depth:returns the depth of a matrixelement;
Mat::channels:returns the number of matrix channels;
Mat::step1:returns a normalized step;
Mat::size:returns a matrix size;
Mat::empty:returns true if the array has noelemens;
Mat::ptr:returns a pointer to the specifiedmatrix row;
Mat::at:returns a reference to thespecified array element;
Mat::begin:returns the matrix iterator andsets it to the first matrix element;
Mat::end:returns the matrix iterator andsets it to the after-last matrix element;
calcHist(cvCalcHist):calculates a histogram of a set ofarrays;
compareHist(cvCompareHist):compares two histograms;
equalizeHist(cvEqualizeHist):equalizes the histogram of agrayscale image(直方图均衡化);
normalize:normalizes the norm or value rangeof an array;
CascadeClassifier::CascadeClassifier:loads a classifier from a file;
CascadeClassifier::empth:checks whether the classifier hasbeen loaded;
CascadeClassifier::load(cvLoadHaarClassifierCascade):loads a classifier from a file;
CascadeClassifier::read:reads a classifier from aFileStorage node;
CascadeClassifier::delectMultiScale(cvHaarDetectObjects):detects objects of different sizesin the input image(检测图像中的目标);
CascadeClassifier::setImage(cvSetImagesForHaarClassifierCascade):sets an image for detection(隐藏的cascade(hidden cascade)指定图像);
CascadeClassifier::runAt(cvRunHaarClassifierCascade):runs the detector at the specifiedpoint(在给定位置的图像中运行cascade of boosted classifier);
groupRectangles:groups the object candidaterectangles;
split(cvSplit):divides a multi-channel array intoseveral single-channel arrays;
merge(cvMerge):creates one multichannel array outof several single-channel ones;
mixChannels(cvMixChannels):copies specified channels frominput arrays to the specified channels of output arrays;
setMouseCallback(cvSetMouseCallback):sets mouse handler for thespecified window;
bilateralFilter:applies the bilateral filter to animage(双边滤波);
blur(cvSmooth):blurs an image using thenormalized box filter(均值模糊);
medianBlur:blurs an image using the medianfilter(中值模糊);
boxFilter:blurs an image using the boxfilter;
GaussianBlur:blurs an image using a Gaussianfilter(高斯模糊);
getGaussianKernel:returns Gaussian filtercoefficients;
sepFilter2D:applies a separable linear filterto an image;
filter2D(cvFilter2D):convolves an image with the kernel;
norm(cvNorm):calculates an absolute array norm,an absolute difference norm, or a relative defference norm;
flip(cvFlip):filps a 2D array around vertical,horizontal, or both axes;
Algorithm::get:returns the algorithm parameter;
Algorithm::set:set the algorithm parameter;
Algorithm::write:stores algorithm parameters in afile storage;
Algorithm::read:reads algorithm parameters from afile storage;
Algorithm::getList:returns the list of registeredalgorithms;
Algorithm::create:creates algorithm instance by name;
FaceRecognizer::train:trains a FaceRecognizer with givendata and associated labels;
FaceRecognizer::update:updates a FaceRecognizer withgiven data and associated labels;
FaceRecognizer::predict:predicts a label and associatedconfidence(e.g. distance) for a given input image;
FaceRecognizer::save:saves a FaceRecognizer and itsmodel state;
FaceRecognizer::load:loads a FaceRecognizer and itsmodel state;
createEigenFaceRecognizer:;
createFisherFaceRecognizer:;
createBPHFaceRecognizer:;
getTextSize(cvGetTextSize):calculates the width and height ofa textstring;
putText(cvPutText):draws a text string;
getStructuringElement(cvCreateStructingElementEx):returns a structuring element ofthe specified size and shape for morphological operations;
morphologyEx(cvMorphologyEx):performs advanced morphologicaltransformations;
findContours(cvFindContours):finds contours in a binary image;
drawContours(cvDrawContours):draw contours outlines or filledcontours;
minAreaRect(cvMinAreaRect2):finds a rotated rectangle of theminimum area enclosing the input 2D point set;
floodFill(cvFloodFill):fills a connected component withthe given color;
getRectSubPix(cvGetRectSubPix):retrieves a pixel rectangle froman image with sub-pixel accuracy;
CvSVM::CvSVM:default and training constructors;
CvSVM::train:trains an SVM;
CvSVM::train_auto:trains an SVM with optimalparameters;
CvSVM::predict:predicts the response for inputsample(s);
CvSVM::get_default_grid:generates a grid for SVMparameters;
CvSVM::get_params:returns the current SVM parameters;
CvSVM::get_support_vector:retrieves a number of supportvectors and the particular vector;
CvSVM::get_var_count:returns thenumber of used features(variables count);
CvANN_MLP(multi-layerperceptrons)::CvANN_MLP:the constructors;
CvANN_MLP::create:constructs MLP with the specifiedtopology;
CvANN_MLP::train:trains/updates MLP;
CvANN_MLP::predict:predicts responses for inputsamples;
CvANN_MLP::get_layer_count:returns the number fo layers inthe MLP;
CvANN_MLP::get_layer_size:returns numbers of neurons in eachlayer of the MLP;
CvANN_MLP::get_weights:returns neurons weights of theparticular layer;
CvKNearest::CvKNearest:default and training constructors;
CvKNearest::train:trains the model;
CvKNearest::find_nearest:finds the neighbors and predictsresponses for input vectors;
CvKNearest::get_max_k:returns the number of maximumneighbors that may be passed to the method CvKNearest::find_nearest();
CvKNearest::get_var_count:returns the number of usedfeatures(variables count);
CvKNearest::get_sample_count:returns the total number of trainsamples;
CvKNearest::is_regression:returns type of the problem(truefor regression and false for classification);
HoughLines(cvHoughLines):finds lines in a binary imageusing the standard Hough transform;
HoughLinesP:finds line segments in a binaryimage using the probabilistic Hough transform;
HoughCircles(cvHoughCircles):finds circles in a grayscale imageusing the Hough transform;
line(cvLine):draws a line segment connectingtwo points;
fitLine(cvFitLine):fits a line to a 2D or 3D pointset;
fitEllipse(cvFitEllipse2):fits an ellipse around a set of 2Dpoints;
ellipse(cvEllipse、cvEllipseBox):draws a simple or thick ellipticarc or fills an ellipse sector;
boundingRect(cvBoundingRect):calculatesthe up-right bounding rectangle of a point set;
rectangle(cvRectangle):draws a simple, thick, or filledup-right rectangle;
minEnclosingCircle(cvMinEnclosingCircle):finds acircle of the minimum area enclosing a 2D point set;
circle(cvCircle):draw a circle;
fillPoly:fills the area bounded by one ormore polygons;
approxPolyDP(cvApproxPoly):approximates a polygonal curve(s)with the specified precision;
pointPolygonTest(cvPointPolygonTest):performs a point-in-contour test(判断点在多边形中的位置);
convexHull(cvConvexHull2):finds the convex hull of a pointset;
transpose(cvTranspose):transposes a matrix;
invert(cvInvert):finds the inverse orpseudo-inverse of a matrix;
getStructuringElement(cvCreateStructuringElementEx):returns a structuring element ofthe specified size and shape for morphological operations;
absdiff(cvAbsDiff):calculates the per-elementabsolute difference between two arrays or between an array and a scalar;
subtract(cvSub):calculates the per-elementdifference between two arrays or array and a scalar;
multiply(cvMul):calculates the per-element scaledproduct fo two arrays;
divide(cvDiv):performs per-element division oftwo arrays or a scalar by an array;
bitwise_or(cvOr):calculates the per-elementbit-wise disjunction of two arrays or an array and a scalar;
bitwise_and(cvAnd):calculates the per-elementbit-wise conjunction of two arrays or an array and a scalar;
bitwise_not(cvNot):inverts every bit of an array;
bitwise_xor(cvXor):calculates the per-elementbit-wise “exclusive of” operation on two arrays or an array and a scalar;
erode(cvErode):erodes an image by using a specificstructuring element;
dilate(cvDilate):dilates an image by using aspecific structuring element;
min(cvMin):calculates per-element minimum oftwo arrays or an array and a scalar;
max(cvMax):calculates per-element maximum oftwo arrays or an array and a scalar;
add(cvAdd):calculates the per-element sum oftwo arrays or an array and a scalar;
addWeighted(cvAddWeighted):calculates the weighted sum of twoarrays;
scaleAdd(cvScaleAdd):calculats the sum of a scaledarray and another array;
saturate_cast():template function for accurateconversion from one primitive type to another;
sqrt(cvSqrt):calculates a square root of arrayelements;
pow(cvPow):raises every array element to apower;
abs:calculates an absolute value ofeach matrix element;
convertScaleAbs(cvConvertScaleAbs):scales, calculates absolutevalues, and converts the result to 8-bit;
cuberoot(cvCbrt):computes the cube root of anargument;
exp(cvExp):calculates the exponent of everyarray element;
log(cvLog):calculates the natural logarithmof every array element;
Canny(cvCanny):finds edges in an image using theCanny algorithm;
Sobel(cvSobel):calculates the first, second,third, or mixed image derivatives using an extended Sobel operator;
Scharr:Calculates the first x – or y –image derivative using Scharr operator(Scharr 滤波器);
Laplacian(cvLaplace):calculates the Laplacian of animage;
getDerivKernels:returns filter coefficients forcomputing spatial image derivatives;
contourArea(cvContourArea):calculates a contour area;
LUT(cvLUT):performs a look-up table transformof an array;
calcBackProject(cvCalcBackProject):calculates the back projection ofa histogram(反向投影);
arcLength(cvArcLength):calculates a contour perimeter ora curve length;
meanShift(cvMeanShift):finds an object on a backprojection image;
CamShift(cvCamShift):finds an object center, size, andorientation;
TermCriteria:template class definingtermination criteria for iterative algorithms;
createTrackbar(cvCreateTrackbar):creates a trackbar and attaches itto the specified window;
watershed(cvWatershed):performs a marker-based imagesegmentation using the watershed algorithm;
grabCut:runs the GrabCut algorithm;
compare(cvCmp):performs the per-elementcomparison of two arrays or an array and scalar value;
mean(cvAvg):calculates an average(mean) ofarray elements;
meanStdDev(cvAvgSdv):calculates a mean and standarddeviation of array elements;
cartToPolar(cvCartToPolar):calculates the magnitude and angleof 2D vectors;
moments(cvMoments):calculates all of the moments upto the third order of a polygon or rasterized shape;
matchShapes(cvMatchShapes):compares two shapes;
cornerHarris(cvCornerHarris):Harris edge detector;
goodFeaturesToTrack(cvGoodFeaturesToTrack):determines strong corners on an image;
classFeatureDetector:abstract base class for 2D imagefeature detectors;
classFastFeatureDetector:wrapping class for featuredetection using the FAST() method;
classSURF(SurfFeatureDetector、SurfDescriptorExtractor):extracting Speeded Up Robust Featuresfrom an image;
classSIFT(SiftFeatureDetector):extracting keypoints and computingdescriptors using the Scale Invariant Feature Transform(SIFT) algorithm;
SURF::operator(cvExtractSURF):detects keypoints and computesSURF descriptors for them;
drawKeypoints:draw keypoints;
drawMatches:draws the found matches ofkeypoints from two images;
classDescriptorMatcher:abstract base class for matchingkeypoint descriptors. It has two groups of match methods,for matchingdescriptors of an image with another image or with an image set;
findChessboardCorners(cvFindChessboardCorners):finds the positions of internalcorners of the chessboard;
drawChessboardCorners(cvDrawChessboardCorners):renders the detected chessboardcorners;
calibrateCamera(cvCalibrateCamera2):finds the camera intrinsic andextrinsic parameters from several view of a calibration pattern;
initUndistortRectifyMap(cvInitUndistortMap、cvInitUndistortRectifyMap):computes the undistortion andrectification transformation map;
remap(cvRemap):applies a generic geometricaltransformation to an image;
calibrationMatrixValues:computes useful cameracharacteristics from the camera matrix;
findFundamentalMat(cvFindFundamentalMat):calculates a fundamental matrixfrom the corresponding points in two images;
computeCorrespondEpilines(cvComputeCorrespondEpilines):for points in an image of a stereopair, computes the corresponding epilines in the other image;
findHomography(cvFindHomography):finds a perspective transformationbetween two planes;
warpPerspective(cvWarpPerspective):applies a perspectivetransformation to an image;
getPerspectiveTransform(cvGetPerspectiveTransform):calculates a perspective transformfrom four pairs of the corresponding points;
cornerSubPix(cvFindCornerSubPix):refines the corner locations;
calcOpticalFlowPyrLK(cvCalcOpticalFlowPyrLK):calculates an optical flow for asparse feature set using the iterative Lucas-Kanade method with pyramids;
swap:swaps two matrices;
accumulateWeighted(cvRunningAvg):updates a running average;
classBackgroundSubtractorMOG:gaussian mixture-basedbackground/foreground segmentation algorithm;
randu:generates a singleuniformly-distributed(均匀分布) random number or an array ofrandom numbers;
randn:fills the array with normallydistributed(正态分布) random numbers;
getTickCount:returns the number of ticks;
getTickFrequency:returns the number of ticks persecond(使用getTickCount和getTickFrequency两个函数可以计算执行某个算法所用时间);
CV_Assert:checks a condition at runtime andthrows exception if it fails;
saturate_cast:template function for accurateconversion from one primitive type to another;
classRNG:random number generator;
RNG::next:returns the next random number;
RNG::operatorT:returns the next random number ofthe specified type;
RNG::operator():returns the next random number;
RNG::uniform:returns the next random numbersampled from the uniform distribution;
RNG::gaussian:returns the next random numbersampled from the Gaussian distribution;
RNG::fill:fills arrays with random numbers;
getOptimalDFTSize(cvGetOptimalDFTSize):returns the optimal DFT size for agiven vector size;
copyMakeBorder(cvCopyMakeBorder):forms a border around an image;
dft(cvDFT):performs a forward or inverseDiscrete Fourier transform of a 1D or 2D floating-point array;
magnitude:calculates the magnitude(幅度) of 2D vectors;
classFileStorage:XML/YAML file storage class thanencapsulates all the information necessary for writing or reading data to/froma file;
FileStorage::open:open a file;
FileStorage::isOpened:checks whether the file is opened;
FileStorage::release:closes the file and releases allthe memory buffers;
FileStorage::releaseAndGetString:closes the file and releases allthe memory buffers;
FileStorage::getFirstTopLevelNode:returns the first element of thetop-level mapping;
FileStorage::root:returns the top-level mapping;
FileStorage::operator[]:returns the specified element ofthe top-level mapping;
FileStorage::operator*:returns the obsolete C FileStorage structure;
FileStorage::writeRaw:writes multiple numbers;
FileStorage::writeObj:writes the registered C structure(CvMat、CvMatND、CvSeq);
FileStorage::getDefaultObjectName:returns the normalized object name for thespecified name of a file;
getAffineTransform(cvGetAffineTransform):calculates an affine transformfrom three pairs of the corresponding points;
getRotationMatrix2D(cv2DRotationmatrix):calculates an affine matrix of 2Drotation;
warpAffine(cvWarpAffine):applies an affine transformationto an image;
matchTemplate(cvMatchTemplate):compares a template against overlapped imageregions;