Library to invoke OpenCV functions
Declaration Syntax
C#  Visual Basic  Visual C++ 
public static class CvInvoke
Public NotInheritable Class CvInvoke
public ref class CvInvoke abstract sealed
Members
All Members  Methods  Fields  
Icon  Member  Description 

CV_FOURCC(Char, Char, Char, Char) 
Generate 4character code of codec used to compress the frames. For example, CV_FOURCC('P','I','M','1') is MPEG1 codec, CV_FOURCC('M','J','P','G') is motionjpeg codec etc.
 
CV_IS_SET_ELEM(IntPtr) 
Determined whether the specified node is occupied or not
 
CV_MAKETYPE(Int32, Int32) 
This function performs the same as CV_MAKETYPE macro
 
CV_NEXT_SEQ_ELEM(Int32, MCvSeqReader%) 
Move to the next element in the sequence
 
CV_READ_SEQ_ELEM<(Of <(T>)>)(MCvSeqReader%) 
forward reading the sequence reader
 
cv2DRotationMatrix(MCvPoint2D32f, Double, Double, IntPtr) 
Calculates rotation matrix
 
cvAbsDiff(IntPtr, IntPtr, IntPtr) 
Calculates absolute difference between two arrays.
dst(I)c = abs(src1(I)c  src2(I)c).
All the arrays must have the same data type and the same size (or ROI size)
 
cvAcc(IntPtr, IntPtr, IntPtr) 
Adds the whole image or its selected region to accumulator sum
 
cvAdaptiveThreshold(IntPtr, IntPtr, Double, ADAPTIVE_THRESHOLD_TYPE, THRESH, Int32, Double) 
Transforms grayscale image to binary image.
Threshold calculated individually for each pixel.
For the method CV_ADAPTIVE_THRESH_MEAN_C it is a mean of blockSize x blockSize pixel
neighborhood, subtracted by param1.
For the method CV_ADAPTIVE_THRESH_GAUSSIAN_C it is a weighted sum (gaussian) of blockSize x blockSize pixel neighborhood, subtracted by param1.
 
cvAdd(IntPtr, IntPtr, IntPtr, IntPtr) 
Adds one array to another one:
dst(I)=src1(I)+src2(I) if mask(I)!=0All the arrays must have the same type, except the mask, and the same size (or ROI size)
 
cvAddS(IntPtr, MCvScalar, IntPtr, IntPtr) 
Adds scalar value to every element in the source array src1 and stores the result in dst
dst(I)=src(I)+value if mask(I)!=0
All the arrays must have the same type, except the mask, and the same size (or ROI size)
 
cvAddWeighted(IntPtr, Double, IntPtr, Double, Double, IntPtr) 
Calculated weighted sum of two arrays as following:
dst(I)=src1(I)*alpha+src2(I)*beta+gamma
All the arrays must have the same type and the same size (or ROI size)
 
cvAnd(IntPtr, IntPtr, IntPtr, IntPtr) 
Calculates perelement bitwise logical conjunction of two arrays:
dst(I)=src1(I) & src2(I) if mask(I)!=0
In the case of floatingpoint arrays their bit representations are used for the operation. All the arrays must have the same type, except the mask, and the same size
 
cvAndS(IntPtr, MCvScalar, IntPtr, IntPtr) 
Calculates perelement bitwise conjunction of array and scalar:
dst(I)=src(I)&value if mask(I)!=0
Prior to the actual operation the scalar is converted to the same type as the arrays. In the case of floatingpoint arrays their bit representations are used for the operation. All the arrays must have the same type, except the mask, and the same size
 
cvApproxPoly(IntPtr, Int32, IntPtr, APPROX_POLY_TYPE, Double, Int32) 
Approximates one or more curves and returns the approximation result[s]. In case of multiple curves approximation the resultant tree will have the same structure as the input one (1:1 correspondence).
 
cvArcLength(IntPtr, MCvSlice, Int32) 
Calculates length or curve as sum of lengths of segments between subsequent points
 
cvAvg(IntPtr, IntPtr) 
Calculates the average value M of array elements, independently for each channel:
N = sumI mask(I)!=0
Mc = 1/N * sumI,mask(I)!=0 arr(I)c
If the array is IplImage and COI is set, the function processes the selected channel only and stores the average to the first scalar component (S0).
 
cvAvgSdv(IntPtr, MCvScalar%, MCvScalar%, IntPtr) 
The function cvAvgSdv calculates the average value and standard deviation of array elements, independently for each channel
 
cvBoundingRect(IntPtr, Int32) 
Returns the upright bounding rectangle for 2d point set
 
cvBoundingRect(IntPtr, Boolean) 
Returns the upright bounding rectangle for 2d point set
 
cvBoxPoints(MCvBox2D, array<Single>[]()[]) 
Calculates vertices of the input 2d box.
 
cvCalcArrBackProject(array<IntPtr>[]()[], IntPtr, IntPtr) 
Calculates the back project of the histogram.
For each tuple of pixels at the same position of all input singlechannel images the function puts the value of the histogram bin, corresponding to the tuple, to the destination image.
In terms of statistics, the value of each output image pixel is probability of the observed tuple given the distribution (histogram).
 
cvCalcArrHist(array<IntPtr>[]()[], IntPtr, Int32, IntPtr) 
Calculates the histogram of one or more singlechannel images. The elements of a tuple that is used to increment a histogram bin are taken at the same location from the corresponding input images.
 
cvCalcArrHist(array<IntPtr>[]()[], IntPtr, Boolean, IntPtr) 
Calculates the histogram of one or more singlechannel images. The elements of a tuple that is used to increment a histogram bin are taken at the same location from the corresponding input images.
 
cvCalcBackProject(array<IntPtr>[]()[], IntPtr, IntPtr) 
Calculates the back project of the histogram.
For each tuple of pixels at the same position of all input singlechannel images the function puts the value of the histogram bin, corresponding to the tuple, to the destination image.
In terms of statistics, the value of each output image pixel is probability of the observed tuple given the distribution (histogram).
 
cvCalcCovarMatrix(array<IntPtr>[]()[], Int32, IntPtr, IntPtr, COVAR_METHOD) 
Calculates the covariation matrix and, optionally, mean vector of the set of input vectors.
 
cvCalcEigenObjects(array<IntPtr>[]()[], MCvTermCriteria%, array<IntPtr>[]()[], array<Single>[]()[], IntPtr) 
Calculates orthonormal eigen basis and the averaged object for a group of the input objects.
 
cvCalcGlobalOrientation(IntPtr, IntPtr, IntPtr, Double, Double) 
Calculates the general motion direction in the selected region and returns the angle between 0 and 360. At first the function builds the orientation histogram and finds the basic orientation as a coordinate of the histogram maximum. After that the function calculates the shift relative to the basic orientation as a weighted sum of all orientation vectors: the more recent is the motion, the greater is the weight. The resultant angle is a circular sum of the basic orientation and the shift.
 
cvCalcHist(array<IntPtr>[]()[], IntPtr, Boolean, IntPtr) 
Calculates the histogram of one or more singlechannel images. The elements of a tuple that is used to increment a histogram bin are taken at the same location from the corresponding input images.
 
cvCalcMotionGradient(IntPtr, IntPtr, IntPtr, Double, Double, Int32) 
Calculates the derivatives Dx and Dy of mhi and then calculates gradient orientation as:
orientation(x,y)=arctan(Dy(x,y)/Dx(x,y))
where both Dx(x,y)' and Dy(x,y)' signs are taken into account (as in cvCartToPolar function). After that mask is filled to indicate where the orientation is valid (see delta1 and delta2 description).
 
cvCalcOpticalFlowBM(IntPtr, IntPtr, MCvSize, MCvSize, MCvSize, Int32, IntPtr, IntPtr) 
Calculates optical flow for overlapped blocks block_size.width * block_size.height pixels each, thus the velocity fields are smaller than the original images. For every block in prev the functions tries to find a similar block in curr in some neighborhood of the original block or shifted by (velx(x0,y0),vely(x0,y0)) block as has been calculated by previous function call (if use_previous=1)
 
cvCalcOpticalFlowHS(IntPtr, IntPtr, Int32, IntPtr, IntPtr, Double, MCvTermCriteria) 
Computes flow for every pixel of the first input image using Horn & Schunck algorithm
 
cvCalcOpticalFlowLK(IntPtr, IntPtr, MCvSize, IntPtr, IntPtr) 
Computes flow for every pixel of the first input image using Lucas & Kanade algorithm
 
cvCalcOpticalFlowPyrLK(IntPtr, IntPtr, IntPtr, IntPtr, array<MCvPoint2D32f>[]()[], array<MCvPoint2D32f>[]()[], Int32, MCvSize, Int32, array<Byte>[]()[], array<Single>[]()[], MCvTermCriteria, LKFLOW_TYPE) 
Implements sparse iterative version of LucasKanade optical flow in pyramids ([Bouguet00]). It calculates coordinates of the feature points on the current video frame given their coordinates on the previous frame. The function finds the coordinates with subpixel accuracy.
 
cvCalcPCA(IntPtr, IntPtr, IntPtr, IntPtr, PCA_TYPE) 
Performs PCA analysis of the vector set. First, it uses cvCalcCovarMatrix to compute covariation matrix and then it finds its eigenvalues and eigenvectors. The output number of eigenvalues/eigenvectors should be less than or equal to MIN(rows(data),cols(data)).
 
cvCalcSubdivVoronoi2D(IntPtr) 
Calculates coordinates of virtual points. All virtual points corresponding to some vertex of original subdivision form (when connected together) a boundary of Voronoi cell of that point
 
cvCalibrateCamera2(IntPtr, IntPtr, IntPtr, MCvSize, IntPtr, IntPtr, IntPtr, IntPtr, Int32) 
Estimates intrinsic camera parameters and extrinsic parameters for each of the views
 
cvcamGetCamerasCount()()() 
Get the number of cameras available
 
cvCamShift(IntPtr, MCvRect, MCvTermCriteria, MCvConnectedComp%, MCvBox2D%) 
Implements CAMSHIFT object tracking algrorithm ([Bradski98]). First, it finds an object center using cvMeanShift and, after that, calculates the object size and orientation.
 
cvCanny(IntPtr, IntPtr, Double, Double, Int32) 
Finds the edges on the input image image and marks them in the output image edges using the Canny algorithm. The smallest of threshold1 and threshold2 is used for edge linking, the largest  to find initial segments of strong edges.
 
cvChangeSeqBlock(MCvSeqReader%, Int32)  
cvCheckArr(IntPtr, CHECK_TYPE, Double, Double) 
Checks that every array element is neither NaN nor Infinity. If CV_CHECK_RANGE is set, it also checks that every element is greater than or equal to minVal and less than maxVal.
 
cvCheckContourConvexity(IntPtr) 
Tests whether the input contour is convex or not. The contour must be simple, i.e. without selfintersections.
 
cvCircle(IntPtr, MCvPoint, Int32, MCvScalar, Int32, LINE_TYPE, Int32) 
Draws a simple or filled circle with given center and radius. The circle is clipped by ROI rectangle.
 
cvClearHist(IntPtr) 
Sets all histogram bins to 0 in case of dense histogram and removes all histogram bins in case of sparse array
 
cvClearMemStorage(IntPtr) 
Resets the top (free space boundary) of the storage to the very beginning. This function does not deallocate any memory. If the storage has a parent, the function returns all blocks to the parent.
 
cvClearSeq(IntPtr) 
Removes all elements from the sequence. The function does not return the memory to the storage, but this memory is reused later when new elements are added to the sequence. This function time complexity is O(1).
 
cvClipLine(MCvSize, MCvPoint%, MCvPoint%) 
Calculates a part of the line segment which is entirely in the image. It returns 0 if the line segment is completely outside the image and 1 otherwise.
 
cvCmp(IntPtr, IntPtr, IntPtr, CMP_TYPE) 
Compares the corresponding elements of two arrays and fills the destination mask array:
dst(I)=src1(I) op src2(I),
dst(I) is set to 0xff (all '1'bits) if the particular relation between the elements is true and 0 otherwise.
All the arrays must have the same type, except the destination, and the same size (or ROI size)
 
cvCmpS(IntPtr, Double, IntPtr, CMP_TYPE) 
Compares the corresponding elements of array and scalar and fills the destination mask array:
dst(I)=src(I) op scalar,
where op is '=', '>', '>=', '<', '<=' or '!='.
dst(I) is set to 0xff (all '1'bits) if the particular relation between the elements is true and 0 otherwise. All the arrays must have the same size (or ROI size)
 
cvComputeCorrespondEpilines(IntPtr, Int32, IntPtr, IntPtr) 
For every point in one of the two images of stereopair the function cvComputeCorrespondEpilines finds equation of a line that contains the corresponding point (i.e. projection of the same 3D point) in the other image. Each line is encoded by a vector of 3 elements l=[a,b,c]T, so that:
lT*[x, y, 1]T=0, or
a*x + b*y + c = 0
From the fundamental matrix definition (see cvFindFundamentalMatrix discussion), line l2 for a point p1 in the first image (which_image=1) can be computed as:
l2=F*p1and the line l1 for a point p2 in the second image (which_image=1) can be computed as:
l1=FT*p2Line coefficients are defined up to a scale. They are normalized (a2+b2=1) are stored into correspondent_lines
 
cvContourArea(IntPtr, MCvSlice) 
Calculates area of the whole contour or contour section.
 
cvContourPerimeter(IntPtr) 
Find the perimeter of the contour
 
cvConvert(IntPtr, IntPtr) 
Same as cvConvertScale(src, dest, 1, 0);
 
cvConvertPointsHomogenious(IntPtr, IntPtr) 
Converts 2D or 3D points from/to homogenious coordinates, or simply copies or transposes the array. In case if the input array dimensionality is larger than the output, each point coordinates are divided by the last coordinate
 
cvConvertScale(IntPtr, IntPtr, Double, Double) 
This function has several different purposes and thus has several synonyms. It copies one array to another with optional scaling, which is performed first, and/or optional type conversion, performed after:
dst(I)=src(I)*scale + (shift,shift,...)
All the channels of multichannel arrays are processed independently.
The type conversion is done with rounding and saturation, that is if a result of scaling + conversion can not be represented exactly by a value of destination array element type, it is set to the nearest representable value on the real axis.
In case of scale=1, shift=0 no prescaling is done. This is a specially optimized case and it has the appropriate cvConvert synonym. If source and destination array types have equal types, this is also a special case that can be used to scale and shift a matrix or an image and that fits to cvScale synonym.
 
cvConvertScaleAbs(IntPtr, IntPtr, Double, Double) 
Similar to cvCvtScale but it stores absolute values of the conversion results:
dst(I)=abs(src(I)*scale + (shift,shift,...))
The function supports only destination arrays of 8u (8bit unsigned integers) type, for other types the function can be emulated by combination of cvConvertScale and cvAbs functions.
 
cvConvexHull2(IntPtr, IntPtr, ORIENTATION, Int32) 
The function cvConvexHull2 finds convex hull of 2D point set using Sklansky's algorithm.
 
cvCopy(IntPtr, IntPtr, IntPtr) 
Copies selected elements from input array to output array:
dst(I)=src(I) if mask(I)!=0.
If any of the passed arrays is of IplImage type, then its ROI and COI fields are used. Both arrays must have the same type, the same number of dimensions and the same size. The function can also copy sparse arrays (mask is not supported in this case).
 
cvCornerHarris(IntPtr, IntPtr, Int32, Int32, Double) 
Runs the Harris edge detector on image. Similarly to cvCornerMinEigenVal and cvCornerEigenValsAndVecs, for each pixel it calculates 2x2 gradient covariation matrix M over block_size x block_size neighborhood. Then, it stores
det(M)  k*trace(M)^2
to the destination image. Corners in the image can be found as local maxima of the destination image.
 
cvCountNonZero(IntPtr) 
Returns the number of nonzero elements in arr:
result = sumI arr(I)!=0
In case of IplImage both ROI and COI are supported.
 
cvCreateCameraCapture(Int32) 
Allocates and initialized the CvCapture structure for reading a video stream from the camera. Currently two camera interfaces can be used on Windows: Video for Windows (VFW) and Matrox Imaging Library (MIL); and two on Linux: V4L and FireWire (IEEE1394).
 
cvCreateChildMemStorage(IntPtr) 
Creates a child memory storage that is similar to simple memory storage except for the differences in the memory allocation/deallocation mechanism. When a child storage needs a new block to add to the block list, it tries to get this block from the parent. The first unoccupied parent block available is taken and excluded from the parent block list. If no blocks are available, the parent either allocates a block or borrows one from its own parent, if any. In other words, the chain, or a more complex structure, of memory storages where every storage is a child/parent of another is possible. When a child storage is released or even cleared, it returns all blocks to the parent. In other aspects, the child storage is the same as the simple storage.
 
cvCreateFGDStatModel(IntPtr, IntPtr) 
Create a background model
 
cvCreateFileCapture(String) 
Allocates and initialized the CvCapture structure for reading the video stream from the specified file.
After the allocated structure is not used any more it should be released by cvReleaseCapture function.
 
cvCreateGaussianBGModel(IntPtr, IntPtr) 
Create a Gaussian background model
 
cvCreateHist(Int32, array<Int32>[]()[], HIST_TYPE, array<IntPtr>[]()[], Int32) 
Creates a histogram of the specified size and returns the pointer to the created histogram. If the array ranges is 0, the histogram bin ranges must be specified later via The function cvSetHistBinRanges, though cvCalcHist and cvCalcBackProject may process 8bit images without setting bin ranges, they assume equally spaced in 0..255 bins
 
cvCreateHist(Int32, array<Int32>[]()[], HIST_TYPE, array<IntPtr>[]()[], Boolean) 
Creates a histogram of the specified size and returns the pointer to the created histogram. If the array ranges is 0, the histogram bin ranges must be specified later via The function cvSetHistBinRanges, though cvCalcHist and cvCalcBackProject may process 8bit images without setting bin ranges, they assume equally spaced in 0..255 bins
 
cvCreateImage(MCvSize, IPL_DEPTH, Int32) 
Creates the header and allocates data.
 
cvCreateImageHeader(MCvSize, IPL_DEPTH, Int32) 
Allocates, initializes, and returns the structure IplImage.
 
cvCreateKalman(Int32, Int32, Int32) 
Allocates CvKalman and all its matrices and initializes them somehow.
 
cvCreateMat(Int32, Int32, MAT_DEPTH) 
Allocates header for the new matrix and underlying data, and returns a pointer to the created matrix. Matrices are stored row by row. All the rows are aligned by 4 bytes.
 
cvCreateMemStorage(Int32) 
Creates a memory storage and returns pointer to it. Initially the storage is empty. All fields of the header, except the block_size, are set to 0.
 
cvCreateSeq(Int32, Int32, Int32, IntPtr) 
Creates a sequence and returns the pointer to it. The function allocates the sequence header in the storage block as one continuous chunk and sets the structure fields flags, elem_size, header_size and storage to passed values, sets delta_elems to the default value (that may be reassigned using cvSetSeqBlockSize function), and clears other header fields, including the space after the first sizeof(CvSeq) bytes
 
cvCreateStructuringElementEx(Int32, Int32, Int32, Int32, CV_ELEMENT_SHAPE, array<Int32,2>[,](,)[,]) 
The function cvCreateStructuringElementEx creates an structuring element.
 
cvCreateSubdiv2D(Int32, Int32, Int32, Int32, IntPtr) 
Creates new subdivision
 
cvCreateSubdivDelaunay2D(MCvRect, IntPtr) 
Creates an empty Delaunay subdivision, where 2d points can be added further using function cvSubdivDelaunay2DInsert. All the points to be added must be within the specified rectangle, otherwise a runtime error will be raised.
 
cvCreateVideoWriter(String, Int32, Double, MCvSize, Int32) 
Creates video writer structure.
 
cvCreateVideoWriter(String, Int32, Double, MCvSize, Boolean) 
Creates video writer structure.
 
cvCrossProduct(IntPtr, IntPtr, IntPtr) 
Calculates the cross product of two 3D vectors
 
cvCvtColor(IntPtr, IntPtr, COLOR_CONVERSION) 
Converts input image from one color space to another. The function ignores colorModel and channelSeq fields of IplImage header, so the source image color space should be specified correctly (including order of the channels in case of RGB space, e.g. BGR means 24bit format with B0 G0 R0 B1 G1 R1 ... layout, whereas RGB means 24bit format with R0 G0 B0 R1 G1 B1 ... layout).
 
cvCvtPlaneToPix(IntPtr, IntPtr, IntPtr, IntPtr, IntPtr) 
This function is the opposite to cvSplit. If the destination array has N channels then if the first N input channels are not NULL, all they are copied to the destination array, otherwise if only a single source channel of the first N is not NULL, this particular channel is copied into the destination array, otherwise an error is raised. Rest of source channels (beyond the first N) must always be NULL. For IplImage cvCopy with COI set can be also used to insert a single channel into the image.
 
cvCvtScale(IntPtr, IntPtr, Double, Double) 
This function has several different purposes and thus has several synonyms. It copies one array to another with optional scaling, which is performed first, and/or optional type conversion, performed after:
dst(I)=src(I)*scale + (shift,shift,...)
All the channels of multichannel arrays are processed independently.
The type conversion is done with rounding and saturation, that is if a result of scaling + conversion can not be represented exactly by a value of destination array element type, it is set to the nearest representable value on the real axis.
In case of scale=1, shift=0 no prescaling is done. This is a specially optimized case and it has the appropriate cvConvert synonym. If source and destination array types have equal types, this is also a special case that can be used to scale and shift a matrix or an image and that fits to cvScale synonym.
 
cvCvtSeqToArray(IntPtr, IntPtr, MCvSlice) 
Copies the entire sequence or subsequence to the specified buffer and returns the pointer to the buffer
 
cvDCT(IntPtr, IntPtr, CV_DCT_TYPE) 
Performs forward or inverse transform of 1D or 2D floatingpoint array
 
cvDestroyWindow(String) 
Destroys the window with a given name
 
cvDet(IntPtr) 
Returns determinant of the square matrix mat. The direct method is used for small matrices and Gaussian elimination is used for larger matrices. For symmetric positivedetermined matrices it is also possible to run SVD with U=V=NULL and then calculate determinant as a product of the diagonal elements of W
 
cvDFT(IntPtr, IntPtr, CV_DXT, Int32) 
Performs forward or inverse transform of 1D or 2D floatingpoint array
In case of real (singlechannel) data, the packed format, borrowed from IPL, is used to to represent a result of forward Fourier transform or input for inverse Fourier transform
 
cvDilate(IntPtr, IntPtr, IntPtr, Int32) 
Dilates the source image using the specified structuring element that determines the shape of a pixel neighborhood over which the maximum is taken
The function supports the inplace mode. Dilation can be applied several (iterations) times. In case of color image each channel is processed independently
 
cvDistTransform(IntPtr, IntPtr, DIST_TYPE, Int32, array<Single>[]()[], IntPtr) 
Calculates distance to closest zero pixel for all nonzero pixels of source image
 
cvDiv(IntPtr, IntPtr, IntPtr, Double) 
Divides one array by another:
dst(I)=scale * src1(I)/src2(I), if src1!=NULL
dst(I)=scale/src2(I), if src1=NULL
All the arrays must have the same type, and the same size (or ROI size)
 
cvDotProduct(IntPtr, IntPtr) 
Calculates and returns the Euclidean dot product of two arrays.
src1 dot src2 = sumI(src1(I)*src2(I))
In case of multiple channel arrays the results for all channels are accumulated. In particular, cvDotProduct(a,a), where a is a complex vector, will return a2. The function can process multidimensional arrays, row by row, layer by layer and so on.
 
cvDrawContours(IntPtr, IntPtr, MCvScalar, MCvScalar, Int32, Int32, LINE_TYPE, MCvPoint) 
Draws contour outlines in the image if thickness >=0 or fills area bounded by the contours if thickness<0.
 
cvEigenDecomposite(IntPtr, array<IntPtr>[]()[], IntPtr) 
Calculates all decomposition coefficients for the input object using the previously calculated eigen objects basis and the averaged object
 
cvEigenProjection(array<IntPtr>[]()[], array<Single>[]()[], IntPtr, IntPtr) 
Calculates an object projection to the eigen subspace or, in other words, restores an object using previously calculated eigen objects basis, averaged object, and decomposition coefficients of the restored object.
 
cvEllipse(IntPtr, MCvPoint, MCvSize, Double, Double, Double, MCvScalar, Int32, LINE_TYPE, Int32) 
Draws a simple or thick elliptic arc or fills an ellipse sector. The arc is clipped by ROI rectangle. A piecewiselinear approximation is used for antialiased arcs and thick arcs. All the angles are given in degrees.
 
cvEqualizeHist(IntPtr, IntPtr) 
The algorithm normalizes brightness and increases contrast of the image
 
cvErode(IntPtr, IntPtr, IntPtr, Int32) 
Erodes the source image using the specified structuring element that determines the shape of a pixel neighborhood over which the minimum is taken:
dst=erode(src,element): dst(x,y)=min((x',y') in element))src(x+x',y+y')
The function supports the inplace mode. Erosion can be applied several (iterations) times. In case of color image each channel is processed independently.
 
cvErrorStr(Int32) 
Returns the textual description for the specified error status code. In case of unknown status the function returns NULL pointer.
 
cvExp(IntPtr, IntPtr) 
Calculates exponent of every element of input array:
dst(I)=exp(src(I))
Maximum relative error is 7e6. Currently, the function converts denormalized values to zeros on output
 
cvFillConvexPoly(IntPtr, array<MCvPoint>[]()[], Int32, MCvScalar, LINE_TYPE, Int32) 
Fills convex polygon interior. This function is much faster than The function cvFillPoly and can fill not only the convex polygons but any monotonic polygon, i.e. a polygon whose contour intersects every horizontal line (scan line) twice at the most
 
cvFilter2D(IntPtr, IntPtr, IntPtr, MCvPoint) 
Applies arbitrary linear filter to the image. Inplace operation is supported. When the aperture is partially outside the image, the function interpolates outlier pixel values from the nearest pixels that is inside the image
 
cvFindContours(IntPtr, IntPtr, IntPtr%, Int32, RETR_TYPE, CHAIN_APPROX_METHOD, MCvPoint) 
Retrieves contours from the binary image and returns the number of retrieved contours. The pointer first_contour is filled by the function. It will contain pointer to the first most outer contour or NULL if no contours is detected (if the image is completely black). Other contours may be reached from first_contour using h_next and v_next links. The sample in cvDrawContours discussion shows how to use contours for connected component detection. Contours can be also used for shape analysis and object recognition  see squares.c in OpenCV sample directory
 
cvFindCornerSubPix(IntPtr, array<Single,2>[,](,)[,], Int32, MCvSize, MCvSize, MCvTermCriteria) 
Iterates to find the subpixel accurate location of corners, or radial saddle points
 
cvFindExtrinsicCameraParams2(IntPtr, IntPtr, IntPtr, IntPtr, IntPtr, IntPtr) 
Estimates extrinsic camera parameters using known intrinsic parameters and and extrinsic parameters for each view. The coordinates of 3D object points and their correspondent 2D projections must be specified. This function also minimizes backprojection error
 
cvFindFundamentalMat(IntPtr, IntPtr, IntPtr, CV_FM, Double, Double, IntPtr) 
Calculates fundamental matrix using one of four methods listed above and returns the number of fundamental matrices found (1 or 3) and 0, if no matrix is found.
 
cvFindHomography(IntPtr, IntPtr, IntPtr) 
Finds perspective transformation H=hij between the source and the destination planes
 
cvFindNearestPoint2D(IntPtr, MCvPoint2D32f) 
Locates input point within subdivision. It finds subdivision vertex that is the closest to the input point. It is not necessarily one of vertices of the facet containing the input point, though the facet (located using cvSubdiv2DLocate) is used as a starting point.
 
cvFindStereoCorrespondence(IntPtr, IntPtr, Int32, IntPtr, Int32, Double, Double, Double, Double, Double) 
Calculates disparity for stereopair
 
cvFitEllipse2(IntPtr) 
Calculates ellipse that fits best (in leastsquares sense) to a set of 2D points. The meaning of the returned structure fields is similar to those in cvEllipse except that size stores the full lengths of the ellipse axises, not halflengths
 
cvFitLine(IntPtr, DIST_TYPE, Double, Double, Double, array<Single>[]()[]) 
Fits line to 2D or 3D point set
 
cvFlip(IntPtr, IntPtr, Int32) 
Flips the array in one of different 3 ways (row and column indices are 0based):
dst(i,j)=src(rows(src)i1,j) if flip_mode = 0
dst(i,j)=src(i,cols(src1)j1) if flip_mode > 0
dst(i,j)=src(rows(src)i1,cols(src)j1) if flip_mode < 0
 
cvFloodFill(IntPtr, MCvPoint, MCvScalar, MCvScalar, MCvScalar, MCvConnectedComp%, Int32, IntPtr) 
Fills a connected component with given color.
 
cvGEMM(IntPtr, IntPtr, Double, IntPtr, Double, IntPtr, GEMM_TYPE) 
Performs generalized matrix multiplication:
dst = alpha*op(src1)*op(src2) + beta*op(src3), where op(X) is X or XT
 
cvGet1D(IntPtr, Int32) 
Return the particular array element
 
cvGet2D(IntPtr, Int32, Int32) 
Return the particular array element
 
cvGet3D(IntPtr, Int32, Int32, Int32) 
Return the particular array element
 
cvGetCaptureProperty(IntPtr, CAP_PROP) 
Retrieves the specified property of camera or video file
 
cvGetCentralMoment(MCvMoments%, Int32, Int32) 
Retrieves the central moment, which in case of image moments is defined as:
Mu xOrder,yOrder=sumx,y(I(x,y) * (xxc)xOrder *(yyc)yOrder),
where xc=M10/M00, yc=M01/M00  coordinates of the gravity center
 
cvGetCol(IntPtr, IntPtr, Int32) 
Return the header, corresponding to a specified column of the input array
 
cvGetCols(IntPtr, IntPtr, Int32, Int32) 
Return the header, corresponding to a specified col span of the input array
 
cvGetErrMode()()() 
Returns the current error mode
 
cvGetErrStatus()()() 
Returns the current error status  the value set with the last cvSetErrStatus call. Note, that in Leaf mode the program terminates immediately after error occured, so to always get control after the function call, one should call cvSetErrMode and set Parent or Silent error mode.
 
cvGetHuMoments(MCvMoments%, MCvHuMoments%) 
Calculates seven Hu invariants
 
cvGetImageCOI(IntPtr) 
Returns channel of interest of the image (it returns 0 if all the channels are selected).
 
cvGetImageROI(IntPtr) 
Returns channel of interest of the image (it returns 0 if all the channels are selected).
 
cvGetNumThreads()()() 
Return the current number of threads that are used by parallelized (via OpenMP) OpenCV functions.
 
cvGetRawData(IntPtr, IntPtr%, Int32%, MCvSize%) 
Fills output variables with lowlevel information about the array data. All output parameters are optional, so some of the pointers may be set to NULL. If the array is IplImage with ROI set, parameters of ROI are returned.
 
cvGetReal1D(IntPtr, Int32) 
Return the particular element of singlechannel array. If the array has multiple channels, runtime error is raised. Note that cvGet*D function can be used safely for both singlechannel and multiplechannel arrays though they are a bit slower.
 
cvGetReal2D(IntPtr, Int32, Int32) 
Return the particular element of singlechannel array. If the array has multiple channels, runtime error is raised. Note that cvGet*D function can be used safely for both singlechannel and multiplechannel arrays though they are a bit slower.
 
cvGetReal3D(IntPtr, Int32, Int32, Int32) 
Return the particular element of singlechannel array. If the array has multiple channels, runtime error is raised. Note that cvGet*D function can be used safely for both singlechannel and multiplechannel arrays though they are a bit slower.
 
cvGetRow(IntPtr, IntPtr, Int32) 
Return the header, corresponding to a specified row of the input array
 
cvGetRows(IntPtr, IntPtr, Int32, Int32, Int32) 
Return the header, corresponding to a specified row span of the input array
 
cvGetSeqElem(IntPtr, Int32) 
Finds the element with the given index in the sequence and returns the pointer to it. If the element is not found, the function returns 0. The function supports negative indices, where 1 stands for the last sequence element, 2 stands for the one before last, etc. If the sequence is most likely to consist of a single sequence block or the desired element is likely to be located in the first block, then the macro CV_GET_SEQ_ELEM( elemType, seq, index ) should be used, where the parameter elemType is the type of sequence elements ( CvPoint for example), the parameter seq is a sequence, and the parameter index is the index of the desired element. The macro checks first whether the desired element belongs to the first block of the sequence and returns it if it does, otherwise the macro calls the main function GetSeqElem. Negative indices always cause the cvGetSeqElem call. The function has O(1) time complexity assuming that number of blocks is much smaller than the number of elements.
 
cvGetSpatialMoment(MCvMoments%, Int32, Int32) 
Retrieves the spatial moment, which in case of image moments is defined as:
MxOrder,yOrder=sumx,y(I(x,y) * xxOrder * yyOrder)
where I(x,y) is the intensity of the pixel (x, y).
 
cvGetSubRect(IntPtr, IntPtr, MCvRect) 
Returns header, corresponding to a specified rectangle of the input array. In other words, it allows the user to treat a rectangular part of input array as a standalone array. ROI is taken into account by the function so the subarray of ROI is actually extracted.
 
cvGetTextSize(String, MCvFont%, MCvSize%, Int32%) 
Calculates the binding rectangle for the given text string when a specified font is used
 
cvGetThreadNum()()() 
Returns the index, from 0 to cvGetNumThreads()1, of the thread that called the function. It is a wrapper for the function omp_get_thread_num() from OpenMP runtime. The retrieved index may be used to access localthread data inside the parallelized code fragments.
 
cvGoodFeaturesToTrack(IntPtr, IntPtr, IntPtr, IntPtr, Int32%, Double, Double, IntPtr, Int32, Int32, Double) 
Finds corners with big eigenvalues in the image.
 
cvHaarDetectObjects(IntPtr, IntPtr, IntPtr, Double, Int32, Int32, MCvSize) 
Finds rectangular regions in the given image that are likely to contain objects the cascade has been trained for and returns those regions as a sequence of rectangles. The function scans the image several times at different scales (see cvSetImagesForHaarClassifierCascade). Each time it considers overlapping regions in the image and applies the classifiers to the regions using cvRunHaarClassifierCascade. It may also apply some heuristics to reduce number of analyzed regions, such as Canny prunning. After it has proceeded and collected the candidate rectangles (regions that passed the classifier cascade), it groups them and returns a sequence of average rectangles for each large enough group. The default parameters (scale_factor=1.1, min_neighbors=3, flags=0) are tuned for accurate yet slow object detection. For a faster operation on real video images the settings are: scale_factor=1.2, min_neighbors=2, flags=CV_HAAR_DO_CANNY_PRUNING, min_size=<minimum possible face size> (for example, ~1/4 to 1/16 of the image area in case of video conferencing).
 
cvHoughCircles(IntPtr, IntPtr, HOUGH_TYPE, Double, Double, Double, Double, Int32, Int32) 
Finds circles in grayscale image using some modification of Hough transform
 
cvHoughLines2(IntPtr, IntPtr, HOUGH_TYPE, Double, Double, Int32, Double, Double) 
The function cvHoughLines2 implements a few variants of Hough transform for line detection
 
cvInitFont(MCvFont%, FONT, Double, Double, Double, Int32, LINE_TYPE) 
Initializes the font structure that can be passed to text rendering functions
 
cvInitImageHeader(IntPtr, MCvSize, Int32, Int32, Int32, Int32) 
Initializes the image header structure, pointer to which is passed by the user, and returns the pointer.
 
cvInitMatHeader(IntPtr, Int32, Int32, MAT_DEPTH, IntPtr, Int32) 
Initializes already allocated CvMat structure. It can be used to process raw data with OpenCV matrix functions.
 
cvInitSubdivDelaunay2D(IntPtr, MCvRect) 
Initializes Delaunay triangulation
 
cvInitUndistortMap(IntPtr, IntPtr, IntPtr, IntPtr) 
Precomputes the undistortion map  coordinates of the corresponding pixel in the distorted image for every pixel in the corrected image. Then, the map (together with input and output images) can be passed to cvRemap function.
 
cvInpaint(IntPtr, IntPtr, IntPtr, INPAINT_TYPE, Double) 
Reconstructs the selected image area from the pixel near the area boundary. The function may be used to remove dust and scratches from a scanned photo, or to remove undesirable objects from still images or video.
 
cvInRangeS(IntPtr, MCvScalar, MCvScalar, IntPtr) 
Does the range check for every element of the input array:
dst(I)=lower0 <= src(I)0 < upper0
for a singlechannel array,
dst(I)=lower0 <= src(I)0 < upper0 &&
lower1 <= src(I)1 < upper1
for a twochannel array etc.
dst(I) is set to 0xff (all '1'bits) if src(I) is within the range and 0 otherwise. All the arrays must have the same size (or ROI size)
 
cvIntegral(IntPtr, IntPtr, IntPtr, IntPtr) 
Calculates one or more integral images for the source image
Using these integral images, one may calculate sum, mean, standard deviation over arbitrary upright or rotated rectangular region of the image in a constant time.
It makes possible to do a fast blurring or fast block correlation with variable window size etc. In case of multichannel images sums for each channel are accumulated independently.
 
cvInvert(IntPtr, IntPtr, INVERT_METHOD) 
Inverts matrix src1 and stores the result in src2
 
cvKalmanCorrect(IntPtr, IntPtr) 
Adjusts stochastic model state on the basis of the given measurement of the model state.
The function stores adjusted state at kalman>state_post and returns it on output
 
cvKalmanCorrect(MCvKalman%, IntPtr) 
Adjusts stochastic model state on the basis of the given measurement of the model state.
The function stores adjusted state at kalman>state_post and returns it on output
 
cvKalmanPredict(IntPtr, IntPtr) 
Estimates the subsequent stochastic model state by its current state and stores it at kalman>state_pre
The function returns the estimated state
 
cvKalmanPredict(MCvKalman%, IntPtr) 
Estimates the subsequent stochastic model state by its current state and stores it at kalman>state_pre
The function returns the estimated state
 
cvLaplace(IntPtr, IntPtr, Int32) 
Calculates Laplacian of the source image by summing second x and y derivatives calculated using Sobel operator:
dst(x,y) = d2src/dx2 + d2src/dy2
Specifying aperture_size=1 gives the fastest variant that is equal to convolving the image with the following kernel:
0 1 0
1 4 1
0 1 0
Similar to cvSobel function, no scaling is done and the same combinations of input and output formats are supported.
 
cvLine(IntPtr, MCvPoint, MCvPoint, MCvScalar, Int32, LINE_TYPE, Int32) 
Draws the line segment between pt1 and pt2 points in the image. The line is clipped by the image or ROI rectangle. For nonantialiased lines with integer coordinates the 8connected or 4connected Bresenham algorithm is used. Thick lines are drawn with rounding endings. Antialiased lines are drawn using Gaussian filtering.
 
cvLoad(String, IntPtr, String, IntPtr) 
Loads object from file. It provides a simple interface to cvRead. After object is loaded, the file storage is closed and all the temporary buffers are deleted. Thus, to load a dynamic structure, such as sequence, contour or graph, one should pass a valid destination memory storage to the function.
 
cvLoadImage(String, LOAD_IMAGE_TYPE) 
Loads an image from the specified file and returns the pointer to the loaded image. Currently the following file formats are supported:
Windows bitmaps  BMP, DIB;
JPEG files  JPEG, JPG, JPE;
Portable Network Graphics  PNG;
Portable image format  PBM, PGM, PPM;
Sun rasters  SR, RAS;
TIFF files  TIFF, TIF;
OpenEXR HDR images  EXR;
JPEG 2000 images  jp2.
 
cvLog(IntPtr, IntPtr) 
Calculates natural logarithm of absolute value of every element of input array:
dst(I)=log(abs(src(I))), src(I)!=0
dst(I)=C, src(I)=0
Where C is large negative number (700 in the current implementation)
 
cvLUT(IntPtr, IntPtr, IntPtr) 
Fills the destination array with values from the lookup table. Indices of the entries are taken from the source array. That is, the function processes each element of src as following:
dst(I)=lut[src(I)+DELTA]
where DELTA=0 if src has depth CV_8U, and DELTA=128 if src has depth CV_8S
 
cvMahalanobis(IntPtr, IntPtr, IntPtr) 
Calculates the weighted distance between two vectors and returns it
 
cvMat(Int32, Int32, MAT_DEPTH, IntPtr) 
A fast inline substitution for cvInitMatHeader. Namely, it is equivalent to:
CvMat mat;
cvInitMatHeader( &mat, rows, cols, type, data, CV_AUTOSTEP );
 
cvMatchTemplate(IntPtr, IntPtr, IntPtr, TM_TYPE) 
This function is similiar to cvCalcBackProjectPatch. It slids through image, compares overlapped patches of size wxh with templ using the specified method and stores the comparison results to result
 
cvMax(IntPtr, IntPtr, IntPtr) 
Calculates perelement maximum of two arrays:
dst(I)=max(src1(I), src2(I))
All the arrays must have a single channel, the same data type and the same size (or ROI size).
 
cvMaxRect(MCvRect%, MCvRect%) 
Finds minimum area rectangle that contains both input rectangles inside
 
cvMaxS(IntPtr, Double, IntPtr)  Calculates perelement maximum of array and scalar: dst(I)=max(src(I), value) All the arrays must have a single channel, the same data type and the same size (or ROI size).  
cvMeanShift(IntPtr, MCvRect, MCvTermCriteria, MCvConnectedComp%) 
Iterates to find the object center given its back projection and initial position of search window. The iterations are made until the search window center moves by less than the given value and/or until the function has done the maximum number of iterations.
 
cvMerge(IntPtr, IntPtr, IntPtr, IntPtr, IntPtr) 
This function is the opposite to cvSplit. If the destination array has N channels then if the first N input channels are not NULL, all they are copied to the destination array, otherwise if only a single source channel of the first N is not NULL, this particular channel is copied into the destination array, otherwise an error is raised. Rest of source channels (beyond the first N) must always be NULL. For IplImage cvCopy with COI set can be also used to insert a single channel into the image.
 
cvMin(IntPtr, IntPtr, IntPtr) 
Calculates perelement minimum of two arrays:
dst(I)=min(src1(I),src2(I))
All the arrays must have a single channel, the same data type and the same size (or ROI size).
 
cvMinAreaRect2(IntPtr, IntPtr) 
Finds a circumscribed rectangle of the minimal area for 2D point set by building convex hull for the set and applying rotating calipers technique to the hull.
 
cvMinEnclosingCircle(IntPtr, MCvPoint2D32f%, Single%) 
Finds the minimal circumscribed circle for 2D point set using iterative algorithm. It returns nonzero if the resultant circle contains all the input points and zero otherwise (i.e. algorithm failed)
 
cvMinMaxLoc(IntPtr, Double%, Double%, MCvPoint%, MCvPoint%, IntPtr) 
Finds minimum and maximum element values and their positions. The extremums are searched over the whole array, selected ROI (in case of IplImage) or, if mask is not NULL, in the specified array region. If the array has more than one channel, it must be IplImage with COI set. In case if multidimensional arrays min_loc>x and max_loc>x will contain raw (linear) positions of the extremums
 
cvMinS(IntPtr, Double, IntPtr) 
Calculates minimum of array and scalar:
dst(I)=min(src(I), value)
All the arrays must have a single channel, the same data type and the same size (or ROI size).
 
cvMoments(IntPtr, MCvMoments%, Int32) 
Calculates spatial and central moments up to the third order and writes them to moments. The moments may be used then to calculate gravity center of the shape, its area, main axises and various shape characeteristics including 7 Hu invariants.
 
cvMorphologyEx(IntPtr, IntPtr, IntPtr, IntPtr, CV_MORPH_OP, Int32) 
Performs advanced morphological transformations.
 
cvMul(IntPtr, IntPtr, IntPtr, Double) 
Calculates perelement product of two arrays:
dst(I)=scale*src1(I)*src2(I)
All the arrays must have the same type, and the same size (or ROI size)
 
cvMulTransposed(IntPtr, IntPtr, Int32, IntPtr) 
Calculates the product of src and its transposition.
The function evaluates dst=(srcdelta)*(srcdelta)^T if order=0, and dst=(srcdelta)^T*(srcdelta) otherwise.
 
cvNamedWindow(String) 
Creates a window which can be used as a placeholder for images and trackbars. Created windows are reffered by their names.
If the window with such a name already exists, the function does nothing.
 
cvNorm(IntPtr, IntPtr, NORM_TYPE, IntPtr) 
Returns the calculated norm. The multiplechannel array are treated as singlechannel, that is, the results for all channels are combined.
 
cvNormalize(IntPtr, IntPtr, Double, Double, NORM_TYPE, IntPtr) 
normalizes the input array so that it's norm or value range takes the certain value(s).
 
cvNormalizeHist(IntPtr, Double) 
Normalizes the histogram bins by scaling them, such that the sum of the bins becomes equal to factor
 
cvNot(IntPtr, IntPtr) 
Inverses every bit of every array element:
 
cvOr(IntPtr, IntPtr, IntPtr, IntPtr) 
Calculates perelement bitwise disjunction of two arrays:
dst(I)=src1(I)src2(I)
In the case of floatingpoint arrays their bit representations are used for the operation. All the arrays must have the same type, except the mask, and the same size
 
cvOrS(IntPtr, MCvScalar, IntPtr, IntPtr) 
Calculates perelement bitwise disjunction of array and scalar:
dst(I)=src(I)value if mask(I)!=0
Prior to the actual operation the scalar is converted to the same type as the arrays. In the case of floatingpoint arrays their bit representations are used for the operation. All the arrays must have the same type, except the mask, and the same size
 
cvPerspectiveTransform(IntPtr, IntPtr, IntPtr) 
transforms every element of src (by treating it as 2D or 3D vector) in the following way:
(x, y, z) > (x?/w, y?/w, z?/w) or
(x, y) > (x?/w, y?/w),
where
(x?, y?, z?, w?) = mat4x4*(x, y, z, 1) or
(x?, y?, w?) = mat3x3*(x, y, 1)
and w = w? if w?!=0,
inf otherwise
 
cvPointPolygonTest(IntPtr, MCvPoint2D32f, Int32) 
Determines whether the point is inside contour, outside, or lies on an edge (or coinsides with a vertex). It returns positive, negative or zero value, correspondingly
 
cvPointPolygonTest(IntPtr, MCvPoint2D32f, Boolean) 
Determines whether the point is inside contour, outside, or lies on an edge (or coinsides with a vertex). It returns positive, negative or zero value, correspondingly
 
cvPolyLine(IntPtr, array<IntPtr>[]()[], array<Int32>[]()[], Int32, Int32, MCvScalar, Int32, LINE_TYPE, Int32) 
Draws a single or multiple polygonal curves
 
cvPolyLine(IntPtr, array<IntPtr>[]()[], array<Int32>[]()[], Int32, Boolean, MCvScalar, Int32, LINE_TYPE, Int32) 
Draws a single or multiple polygonal curves
 
cvPow(IntPtr, IntPtr, Double) 
Raises every element of input array to p:
dst(I)=src(I)p, if p is integer
dst(I)=abs(src(I))p, otherwise
That is, for noninteger power exponent the absolute values of input array elements are used. However, it is possible to get true values for negative values using some extra operations, as the following sample, computing cube root of array elements, shows:
CvSize size = cvGetSize(src);
CvMat* mask = cvCreateMat( size.height, size.width, CV_8UC1 );
cvCmpS( src, 0, mask, CV_CMP_LT ); /* find negative elements */
cvPow( src, dst, 1./3 );
cvSubRS( dst, cvScalarAll(0), dst, mask ); /* negate the results of negative inputs */
cvReleaseMat( &mask );
For some values of power, such as integer values, 0.5 and 0.5, specialized faster algorithms are used.
 
cvProjectPoints2(IntPtr, IntPtr, IntPtr, IntPtr, IntPtr, IntPtr, IntPtr, IntPtr, IntPtr, IntPtr, IntPtr) 
Computes projections of 3D points to the image plane given intrinsic and extrinsic camera parameters. Optionally, the function computes jacobians  matrices of partial derivatives of image points as functions of all the input parameters w.r.t. the particular parameters, intrinsic and/or extrinsic. The jacobians are used during the global optimization in cvCalibrateCamera2 and cvFindExtrinsicCameraParams2. The function itself is also used to compute backprojection error for with current intrinsic and extrinsic parameters.
Note, that with intrinsic and/or extrinsic parameters set to special values, the function can be used to compute just extrinsic transformation or just intrinsic transformation (i.e. distortion of a sparse set of points).
 
cvPutText(IntPtr, String, MCvPoint, MCvFont%, MCvScalar) 
Renders the text in the image with the specified font and color. The printed text is clipped by ROI rectangle. Symbols that do not belong to the specified font are replaced with the rectangle symbol.
 
cvPyrDown(IntPtr, IntPtr, FILTER_TYPE) 
Performs downsampling step of Gaussian pyramid decomposition. First it convolves source image with the specified filter and then downsamples the image by rejecting even rows and columns.
 
cvPyrSegmentation(IntPtr, IntPtr, IntPtr, IntPtr%, Int32, Double, Double) 
The function cvPyrSegmentation implements image segmentation by pyramids. The pyramid builds up to the level level. The links between any pixel a on level i and its candidate father pixel b on the adjacent level are established if
p(c(a),c(b))>threshold1. After the connected components are defined, they are joined into several clusters. Any two segments A and B belong to the same cluster, if
p(c(A),c(B))>threshold2. The input image has only one channel, then
p(c1,c2)=c1c2. If the input image has three channels (red, green and blue), then
p(c1,c2)=0.3*(c1rc2r)+0.59 * (c1gc2g)+0.11 *(c1bc2b) . There may be more than one connected component per a cluster.
 
cvPyrUp(IntPtr, IntPtr, FILTER_TYPE) 
Performs upsampling step of Gaussian pyramid decomposition. First it upsamples the source image by injecting even zero rows and columns and then convolves result with the specified filter multiplied by 4 for interpolation. So the destination image is four times larger than the source image.
 
cvQueryFrame(IntPtr) 
Grabs a frame from camera or video file, decompresses and returns it. This function is just a combination of cvGrabFrame and cvRetrieveFrame in one call. The returned image should not be released or modified by user.
 
cvQueryHistValue_1D(IntPtr, Int32) 
Return the value of the specified bin of 1D histogram. In case of sparse histogram the function returns 0, if the bin is not present in the histogram, and no new bin is created.
 
cvQueryHistValue_2D(IntPtr, Int32, Int32) 
Return the value of the specified bin of 2D histogram. In case of sparse histogram the function returns 0, if the bin is not present in the histogram, and no new bin is created.
 
cvQueryHistValue_3D(IntPtr, Int32, Int32, Int32) 
Return the value of the specified bin of 3D histogram. In case of sparse histogram the function returns 0, if the bin is not present in the histogram, and no new bin is created.
 
cvRandArr(UInt64%, IntPtr, RAND_TYPE, MCvScalar, MCvScalar) 
Fills the destination array with uniformly or normally distributed random numbers.
 
cvRectangle(IntPtr, MCvPoint, MCvPoint, MCvScalar, Int32, LINE_TYPE, Int32) 
Draws a rectangle with two opposite corners pt1 and pt2
 
cvRedirectError(CvInvoke..::.CvErrorCallback, IntPtr, IntPtr) 
Sets a new error handler that can be one of standard handlers or a custom handler that has the certain interface. The handler takes the same parameters as cvError function. If the handler returns nonzero value, the program is terminated, otherwise, it continues. The error handler may check the current error mode with cvGetErrMode to make a decision.
 
cvReduce(IntPtr, IntPtr, REDUCE_TYPE) 
Reduces matrix to a vector by treating the matrix rows/columns as a set of 1D vectors and performing the specified operation on the vectors until a single row/column is obtained.
 
cvReleaseCapture(IntPtr%) 
The function cvReleaseCapture releases the CvCapture structure allocated by cvCreateFileCapture or cvCreateCameraCapture
 
cvReleaseHaarClassifierCascade(IntPtr%) 
Deallocates the cascade that has been created manually or loaded using cvLoadHaarClassifierCascade or cvLoad
 
cvReleaseHist(IntPtr%) 
Releases the histogram (header and the data).
The pointer to histogram is cleared by the function.
If *hist pointer is already NULL, the function does nothing.
 
cvReleaseImage(IntPtr%) 
Releases the header and the image data.
 
cvReleaseImageHeader(IntPtr%) 
Releases the header.
 
cvReleaseKalman(IntPtr%) 
Releases the structure CvKalman and all underlying matrices
 
cvReleaseMat(IntPtr%) 
Decrements the matrix data reference counter and releases matrix header
 
cvReleaseMemStorage(IntPtr%) 
Deallocates all storage memory blocks or returns them to the parent, if any. Then it deallocates the storage header and clears the pointer to the storage. All children of the storage must be released before the parent is released.
 
cvReleaseStructuringElement(IntPtr%) 
Releases the structuring element.
 
cvReleaseVideoWriter(IntPtr%) 
Finishes writing to video file and releases the structure.
 
cvRemap(IntPtr, IntPtr, IntPtr, IntPtr, Int32, MCvScalar) 
Similar to other geometrical transformations, some interpolation method (specified by user) is used to extract pixels with noninteger coordinates.
 
cvRepeat(IntPtr, IntPtr) 
Fills the destination array with source array tiled:
dst(i,j)=src(i mod rows(src), j mod cols(src))So the destination array may be as larger as well as smaller than the source array
 
cvResetImageROI(IntPtr) 
Releases image ROI. After that the whole image is considered selected.
 
cvResize(IntPtr, IntPtr, INTER) 
Resizes image src so that it fits exactly to dst. If ROI is set, the function consideres the ROI as supported as usual
 
cvRodrigues2(IntPtr, IntPtr, IntPtr) 
Converts a rotation vector to rotation matrix or vice versa. Rotation vector is a compact representation of rotation matrix. Direction of the rotation vector is the rotation axis and the length of the vector is the rotation angle around the axis. The rotation matrix R, corresponding to the rotation vector r.
 
cvRunningAvg(IntPtr, IntPtr, Double, IntPtr) 
Calculates weighted sum of input image image and the accumulator acc so that acc becomes a running average of frame sequence:
acc(x,y)=(1alpha) * acc(x,y) + alpha * image(x,y) if mask(x,y)!=0
where alpha regulates update speed (how fast accumulator forgets about previous frames).
 
cvSampleLine(IntPtr, MCvPoint, MCvPoint, IntPtr, Int32) 
Implements a particular case of application of line iterators. The function reads all the image points lying on the line between pt1 and pt2, including the ending points, and stores them into the buffer
 
cvSaveImage(String, IntPtr) 
Saves the image to the specified file. The image format is chosen depending on the filename extension, see cvLoadImage. Only 8bit singlechannel or 3channel (with 'BGR' channel order) images can be saved using this function. If the format, depth or channel order is different, use cvCvtScale and cvCvtColor to convert it before saving, or use universal cvSave to save the image to XML or YAML format
 
cvSegmentMotion(IntPtr, IntPtr, IntPtr, Double, Double) 
Finds all the motion segments and marks them in seg_mask with individual values each (1,2,...). It also returns a sequence of CvConnectedComp structures, one per each motion components. After than the motion direction for every component can be calculated with cvCalcGlobalOrientation using extracted mask of the particular component (using cvCmp)
 
cvSeqPush(IntPtr, IntPtr) 
Adds an element to the end of sequence and retuns pointer to the allocated element. If the input element is NULL, the function simply allocates a space for one more element.
 
cvSeqPushMulti(IntPtr, IntPtr, Int32, Int32) 
Adds several elements to either end of the sequence. The elements are added to the sequence in the same order as they are arranged in the input array but they can fall into different sequence blocks.
 
cvSeqPushMulti(IntPtr, IntPtr, Int32, Boolean) 
Adds several elements to either end of the sequence. The elements are added to the sequence in the same order as they are arranged in the input array but they can fall into different sequence blocks.
 
cvSeqSlice(IntPtr, MCvSlice, IntPtr, Int32) 
Creates a sequence that represents the specified slice of the input sequence. The new sequence either shares the elements with the original sequence or has own copy of the elements. So if one needs to process a part of sequence but the processing function does not have a slice parameter, the required subsequence may be extracted using this function.
 
cvSeqSlice(IntPtr, MCvSlice, IntPtr, Boolean) 
Creates a sequence that represents the specified slice of the input sequence. The new sequence either shares the elements with the original sequence or has own copy of the elements. So if one needs to process a part of sequence but the processing function does not have a slice parameter, the required subsequence may be extracted using this function.
 
cvSet(IntPtr, MCvScalar, IntPtr) 
Copies scalar value to every selected element of the destination array:
arr(I)=value if mask(I)!=0
If array arr is of IplImage type, then is ROI used, but COI must not be set
 
cvSet2D(IntPtr, Int32, Int32, MCvScalar) 
Assign the new value to the particular element of array
 
cvSetCaptureProperty(IntPtr, CAP_PROP, Double) 
Sets the specified property of video capturing
 
cvSetData(IntPtr, IntPtr, Int32) 
Assigns user data to the array header.
 
cvSetErrMode(Int32) 
Sets the specified error mode.
 
cvSetErrStatus(ERROR_CODES) 
Sets the error status to the specified value. Mostly, the function is used to reset the error status (set to it CV_StsOk) to recover after error. In other cases it is more natural to call cvError or CV_ERROR.
 
cvSetIdentity(IntPtr, MCvScalar) 
Initializes scaled identity matrix:
arr(i,j)=value if i=j,
0 otherwise
 
cvSetImageCOI(IntPtr, Int32) 
Sets the channel of interest to a given value. Value 0 means that all channels are selected, 1 means that the first channel is selected etc. If ROI is NULL and coi != 0, ROI is allocated.
 
cvSetImageROI(IntPtr, MCvRect) 
Sets the image ROI to a given rectangle. If ROI is NULL and the value of the parameter rect is not equal to the whole image, ROI is allocated.
 
cvSetNumThreads(Int32) 
Sets the number of threads that are used by parallelized OpenCV functions.
 
cvShowImage(String, IntPtr) 
Shows the image in the specified window
 
cvSmooth(IntPtr, IntPtr, SMOOTH_TYPE, Int32, Int32, Double, Double) 
Smooths image using one of several methods. Every of the methods has some features and restrictions listed below
Blur with no scaling works with singlechannel images only and supports accumulation of 8bit to 16bit format (similar to cvSobel and cvLaplace) and 32bit floating point to 32bit floatingpoint format.
Simple blur and Gaussian blur support 1 or 3channel, 8bit and 32bit floating point images. These two methods can process images inplace.
Median and bilateral filters work with 1 or 3channel 8bit images and can not process images inplace.
 
cvSnakeImage(IntPtr, IntPtr, Int32, array<Single>[]()[], array<Single>[]()[], array<Single>[]()[], Int32, MCvSize, MCvTermCriteria, Int32) 
Updates snake in order to minimize its total energy that is a sum of internal energy that depends on contour shape (the smoother contour is, the smaller internal energy is) and external energy that depends on the energy field and reaches minimum at the local energy extremums that correspond to the image edges in case of image gradient.
 
cvSnakeImage(IntPtr, IntPtr, Int32, array<Single>[]()[], array<Single>[]()[], array<Single>[]()[], Int32, MCvSize, MCvTermCriteria, Boolean) 
Updates snake in order to minimize its total energy that is a sum of internal energy that depends on contour shape (the smoother contour is, the smaller internal energy is) and external energy that depends on the energy field and reaches minimum at the local energy extremums that correspond to the image edges in case of image gradient.
 
cvSobel(IntPtr, IntPtr, Int32, Int32, Int32) 
The Sobel operators combine Gaussian smoothing and differentiation so the result is more or less robust to the noise. Most often, the function is called with (xorder=1, yorder=0, aperture_size=3) or (xorder=0, yorder=1, aperture_size=3) to calculate first x or y image derivative. The first case corresponds to
1 0 1 2 0 2 1 0 1kernel and the second one corresponds to 1 2 1  0 0 0  1 2 1 or  1 2 1  0 0 0 1 2 1 kernel, depending on the image origin (origin field of IplImage structure). No scaling is done, so the destination image usually has larger by absolute value numbers than the source image. To avoid overflow, the function requires 16bit destination image if the source image is 8bit. The result can be converted back to 8bit using cvConvertScale or cvConvertScaleAbs functions. Besides 8bit images the function can process 32bit floatingpoint images. Both source and destination must be singlechannel images of equal size or ROI size  
cvSplit(IntPtr, IntPtr, IntPtr, IntPtr, IntPtr) 
Divides a multichannel array into separate singlechannel arrays. Two modes are available for the operation. If the source array has N channels then if the first N destination channels are not NULL, all they are extracted from the source array, otherwise if only a single destination channel of the first N is not NULL, this particular channel is extracted, otherwise an error is raised. Rest of destination channels (beyond the first N) must always be NULL. For IplImage cvCopy with COI set can be also used to extract a single channel from the image
 
cvStartReadSeq(IntPtr, MCvSeqReader%, Boolean) 
Initializes the reader state
 
cvSub(IntPtr, IntPtr, IntPtr, IntPtr) 
Subtracts one array from another one:
dst(I)=src1(I)src2(I) if mask(I)!=0
All the arrays must have the same type, except the mask, and the same size (or ROI size)
 
cvSubdivDelaunay2DInsert(IntPtr, MCvPoint2D32f) 
Inserts a single point to subdivision and modifies the subdivision topology appropriately. If a points with same coordinates exists already, no new points is added. The function returns pointer to the allocated point. No virtual points coordinates is calculated at this stage.
 
cvSubRS(IntPtr, MCvScalar, IntPtr, IntPtr) 
Subtracts every element of source array from a scalar:
dst(I)=valuesrc(I) if mask(I)!=0
All the arrays must have the same type, except the mask, and the same size (or ROI size)
 
cvSubS(IntPtr, MCvScalar, IntPtr, IntPtr) 
Subtracts a scalar from every element of the source array:
dst(I)=src(I)value if mask(I)!=0
All the arrays must have the same type, except the mask, and the same size (or ROI size)
 
cvSum(IntPtr) 
Calculates sum S of array elements, independently for each channel
Sc = sumI arr(I)c
If the array is IplImage and COI is set, the function processes the selected channel only and stores the sum to the first scalar component (S0).
 
cvSVD(IntPtr, IntPtr, IntPtr, IntPtr, SVD_TYPE) 
Decomposes matrix A into a product of a diagonal matrix and two orthogonal matrices:
A=U*W*VT
Where W is diagonal matrix of singular values that can be coded as a 1D vector of singular values and U and V. All the singular values are nonnegative and sorted (together with U and and V columns) in descenting order.
 
cvThreshHist(IntPtr, Double) 
Clears histogram bins that are below the specified threshold
 
cvThreshold(IntPtr, IntPtr, Double, Double, THRESH) 
Applies fixedlevel thresholding to singlechannel array. The function is typically used to get bilevel (binary) image out of grayscale image (cvCmpS could be also used for this purpose) or for removing a noise, i.e. filtering out pixels with too small or too large values. There are several types of thresholding the function supports that are determined by threshold_type
 
cvTrace(IntPtr) 
Returns sum of diagonal elements of the matrix src1.
 
cvTranspose(IntPtr, IntPtr) 
Transposes matrix src1:
dst(i,j)=src(j,i)
Note that no complex conjugation is done in case of complex matrix. Conjugation should be done separately: look at the sample code in cvXorS for example
 
cvUndistort2(IntPtr, IntPtr, IntPtr, IntPtr) 
Transforms the image to compensate radial and tangential lens distortion. The camera matrix and distortion parameters can be determined using cvCalibrateCamera2. For every pixel in the output image the function computes coordinates of the corresponding location in the input image using the formulae in the section beginning. Then, the pixel value is computed using bilinear interpolation. If the resolution of images is different from what was used at the calibration stage, fx, fy, cx and cy need to be adjusted appropriately, while the distortion coefficients remain the same.
 
cvUpdateMotionHistory(IntPtr, IntPtr, Double, Double) 
Updates the motion history image as following:
mhi(x,y)=timestamp if silhouette(x,y)!=0
0 if silhouette(x,y)=0 and mhi(x,y)<timestampduration
mhi(x,y) otherwise
That is, MHI pixels where motion occurs are set to the current timestamp, while the pixels where motion happened far ago are cleared.
 
cvUseOptimized(Int32) 
Switches between the mode, where only pure C implementations from cxcore, OpenCV etc. are used, and the mode, where IPP and MKL functions are used if available. When cvUseOptimized(0) is called, all the optimized libraries are unloaded. The function may be useful for debugging, IPP&MKL upgrade on the fly, online speed comparisons etc. Note that by default the optimized plugins are loaded, so it is not necessary to call cvUseOptimized(1) in the beginning of the program (actually, it will only increase the startup time)
 
cvUseOptimized(Boolean) 
Switches between the mode, where only pure C implementations from cxcore, OpenCV etc. are used, and the mode, where IPP and MKL functions are used if available. When cvUseOptimized(0) is called, all the optimized libraries are unloaded. The function may be useful for debugging, IPP&MKL upgrade on the fly, online speed comparisons etc. Note that by default the optimized plugins are loaded, so it is not necessary to call cvUseOptimized(1) in the beginning of the program (actually, it will only increase the startup time)
 
cvWaitKey(Int32) 
Waits for key event infinitely (delay <= 0) or for "delay" milliseconds.
 
cvWarpAffine(IntPtr, IntPtr, IntPtr, Int32, MCvScalar) 
Transforms source image using the specified matrix
 
cvWatershed(IntPtr, IntPtr) 
The function cvWatershed implements one of the variants of watershed, nonparametric markerbased segmentation algorithm, described in [Meyer92] Before passing the image to the function, user has to outline roughly the desired regions in the image markers with positive (>0) indices, i.e. every region is represented as one or more connected components with the pixel values 1, 2, 3 etc. Those components will be "seeds" of the future image regions. All the other pixels in markers, which relation to the outlined regions is not known and should be defined by the algorithm, should be set to 0's. On the output of the function, each pixel in markers is set to one of values of the "seed" components, or to 1 at boundaries between the regions.
 
cvWriteFrame(IntPtr, IntPtr) 
Writes/appends one frame to video file.
 
cvXor(IntPtr, IntPtr, IntPtr, IntPtr) 
Calculates perelement bitwise logical conjunction of two arrays:
dst(I)=src1(I)^src2(I) if mask(I)!=0
In the case of floatingpoint arrays their bit representations are used for the operation. All the arrays must have the same type, except the mask, and the same size
 
cvXorS(IntPtr, MCvScalar, IntPtr, IntPtr) 
Calculates perelement bitwise conjunction of array and scalar:
dst(I)=src(I)^value if mask(I)!=0
Prior to the actual operation the scalar is converted to the same type as the arrays. In the case of floatingpoint arrays their bit representations are used for the operation. All the arrays must have the same type, except the mask, and the same size
 
DefaultCvErrorHandler 
The default Exception callback to handle Error thrown by OpenCV

Inheritance Hierarchy
Object  
CvInvoke 