Typedefs | |
typedef struct CvCapture | CvCapture |
"black box" capture structure | |
typedef struct CvVideoWriter | CvVideoWriter |
"black box" video file writer structure | |
Functions | |
CVAPI (CvCapture *) cvCreateFileCapture(const char *filename) | |
start capturing frames from video file | |
CVAPI (int) cvGrabFrame(CvCapture *capture) | |
grab a frame, return 1 on success, 0 on fail. | |
CVAPI (IplImage *) cvRetrieveFrame(CvCapture *capture | |
get the frame grabbed with cvGrabFrame(..) | |
int streamIdx | CV_DEFAULT (0)) |
CVAPI (void) cvReleaseCapture(CvCapture **capture) | |
stop capturing/reading and free resources | |
CVAPI (double) cvGetCaptureProperty(CvCapture *capture | |
retrieve capture properties | |
CVAPI (CvVideoWriter *) cvCreateVideoWriter(const char *filename | |
initialize video file writer | |
int double CvSize int is_color | CV_DEFAULT (1)) |
Variables | |
int | apiPreference |
int | property_id |
int double | value |
int | fourcc |
int double | fps |
int double CvSize | frame_size |
const IplImage * | image |
Obsolete functions/synonyms | |
#define | cvCaptureFromCAM cvCreateCameraCapture |
#define | cvCaptureFromFile cvCreateFileCapture |
#define | cvCaptureFromAVI cvCaptureFromFile |
#define | cvCreateAVIWriter cvCreateVideoWriter |
#define | cvWriteToAVI cvWriteFrame |
#define cvCaptureFromAVI cvCaptureFromFile |
#define cvCaptureFromCAM cvCreateCameraCapture |
#define cvCaptureFromFile cvCreateFileCapture |
#define cvCreateAVIWriter cvCreateVideoWriter |
#define cvWriteToAVI cvWriteFrame |
typedef struct CvCapture CvCapture |
"black box" capture structure
In C++ use cv::VideoCapture
typedef struct CvVideoWriter CvVideoWriter |
"black box" video file writer structure
In C++ use cv::VideoWriter
int streamIdx CV_DEFAULT | ( | 0 | ) |
int double CvSize int is_color CV_DEFAULT | ( | 1 | ) |
CVAPI | ( | CvCapture * | ) | const |
start capturing frames from video file
start capturing frames from camera: index = camera_index + domain_offset (CV_CAP_*)
start capturing frames from video file. allows specifying a preferred API to use
CVAPI | ( | CvVideoWriter * | ) | const |
initialize video file writer
CVAPI | ( | double | ) |
retrieve capture properties
CVAPI | ( | int | ) |
grab a frame, return 1 on success, 0 on fail.
write frame to video file
Return the type of the capturer (eg, CV_CAP_VFW, CV_CAP_UNICAP)
set capture properties
this function is thought to be fast
It is unknown if created with CV_CAP_ANY
CVAPI | ( | IplImage * | ) |
get the frame grabbed with cvGrabFrame(..)
Just a combination of cvGrabFrame and cvRetrieveFrame.
This function may apply some frame processing like frame decompression, flipping etc.
CVAPI | ( | void | ) |
stop capturing/reading and free resources
close video file writer
stop capturing/reading and free resources
Releases an object.
Makes OpenCV use IPL functions for allocating IplImage and IplROI structures.
Calculates the cross product of two 3D vectors.
Fills an array with random numbers and updates the RNG state.
Converts one array to another with optional linear transformation.
Clears the array.
Sets every element of an array to a given value.
Copies one array to another.
Retrieves low-level information about the array.
Assigns user data to the array header.
Releases array data.
Allocates array data.
Change a specific array element.
Change the particular array element.
Deallocates sparse array.
Deallocates a matrix.
Resets the image ROI to include the entire image and releases the ROI structure.
Sets an image Region Of Interest (ROI) for a given rectangle.
Sets the channel of interest in an IplImage.
Deallocates the image header and the image data.
free
wrapper. Here and further all the memory releasing functions (that all call cvFree) take double pointer in order to to clear pointer to the data after releasing it. Passing pointer to NULL pointer is Ok: nothing happens in this case
This call is an analogue of :
but it does not use IPL functions by default (see the CV_TURN_ON_IPL_COMPATIBILITY macro).
image | Double pointer to the image header |
This call is a shortened form of :
image | Double pointer to the image header |
If the ROI is set to NULL and the coi is not 0, the ROI is allocated. Most OpenCV functions do not* support the COI setting, so to process an individual image/matrix channel one may copy (via cvCopy or cvSplit) the channel to a separate image/matrix, process it and then copy the result back (via cvCopy or cvMerge) if needed.
image | A pointer to the image header |
coi | The channel of interest. 0 - all channels are selected, 1 - first channel is selected, etc. Note that the channel indices become 1-based. |
If the original image ROI was NULL and the rect is not the whole image, the ROI structure is allocated.
Most OpenCV functions support the use of ROI and treat the image rectangle as a separate image. For example, all of the pixel coordinates are counted from the top-left (or bottom-left) corner of the ROI, not the original image.
image | A pointer to the image header |
rect | The ROI rectangle |
This produces a similar result to the following, but in addition it releases the ROI structure. :
image | A pointer to the image header |
The function decrements the matrix data reference counter and deallocates matrix header. If the data reference counter is 0, it also deallocates the data. :
mat | Double pointer to the matrix |
low-level scalar <-> raw data conversion functions
The function releases the sparse array and clears the array pointer upon exit.
mat | Double pointer to the array |
The functions assign the new value to a particular array element. In the case of a sparse array the functions create the node if it does not exist yet.
arr | Input array |
idx0 | The first zero-based component of the element index |
value | The assigned value |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
arr | Input array |
idx | Array of the element indices |
value | The assigned value |
The functions assign a new value to a specific element of a single-channel array. If the array has multiple channels, a runtime error is raised. Note that the Set*D function can be used safely for both single-channel and multiple-channel arrays, though they are a bit slower.
In the case of a sparse array the functions create the node if it does not yet exist.
arr | Input array |
idx0 | The first zero-based component of the element index |
value | The assigned value |
clears element of ND dense array, in case of sparse arrays it deletes the specified node
Repeats source 2d array several times in both horizontal and vertical direction to fill destination array
The function allocates image, matrix or multi-dimensional dense array data. Note that in the case of matrix types OpenCV allocation functions are used. In the case of IplImage they are used unless CV_TURN_ON_IPL_COMPATIBILITY() has been called before. In the latter case IPL functions are used to allocate the data.
arr | Array header |
The function releases the array data. In the case of CvMat or CvMatND it simply calls cvDecRefData(), that is the function can not deallocate external data. See also the note to cvCreateData .
arr | Array header |
The function assigns user data to the array header. Header should be initialized before using cvCreateMatHeader, cvCreateImageHeader, cvCreateMatNDHeader, cvInitMatHeader, cvInitImageHeader or cvInitMatNDHeader.
arr | Array header |
data | User data |
step | Full row length in bytes |
The function fills output variables with low-level 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, the parameters of ROI are returned.
The following example shows how to get access to array elements. It computes absolute values of the array elements :
arr | Array header |
data | Output pointer to the whole image origin or ROI origin if ROI is set |
step | Output full row length in bytes |
roi_size | Output ROI size |
The function copies selected elements from an input array to an output array:
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).
src | The source array |
dst | The destination array |
mask | Operation mask, 8-bit single channel array; specifies elements of the destination array to be changed |
The function copies the scalar value to every selected element of the destination array:
If array arr is of IplImage type, then is ROI used, but COI must not be set.
arr | The destination array |
value | Fill value |
mask | Operation mask, 8-bit single channel array; specifies elements of the destination array to be changed |
The function clears the array. In the case of dense arrays (CvMat, CvMatND or IplImage), cvZero(array) is equivalent to cvSet(array,cvScalarAll(0),0). In the case of sparse arrays all the elements are removed.
arr | Array to be cleared |
Splits a multi-channel array into the set of single-channel arrays or extracts particular [color] plane
Merges a set of single-channel arrays into the single multi-channel array or inserts one particular [color] plane to the array
Copies several channels from input arrays to certain channels of output arrays
The function has several different purposes, and thus has several different names. It copies one array to another with optional scaling, which is performed first, and/or optional type conversion, performed after:
All the channels of multi-channel arrays are processed independently.
The type of conversion is done with rounding and saturation, that is if the result of scaling + conversion can not be represented exactly by a value of the destination array element type, it is set to the nearest representable value on the real axis.
src | Source array |
dst | Destination array |
scale | Scale factor |
shift | Value added to the scaled source array elements |
Performs linear transformation on every source array element, stores absolute value of the result: dst(x,y,c) = abs(scale*src(x,y,c)+shift). destination array must have 8u type. In other cases one may use cvConvertScale + cvAbsDiffS
dst(mask) = src1(mask) + src2(mask)
dst(mask) = src(mask) + value
dst(mask) = src1(mask) - src2(mask)
dst(mask) = value - src(mask)
dst(idx) = src1(idx) * src2(idx) * scale (scaled element-wise multiplication of 2 arrays)
element-wise division/inversion with scaling: dst(idx) = src1(idx) * scale / src2(idx) or dst(idx) = scale / src2(idx) if src1 == 0
dst = src1 * scale + src2
dst = src1 * alpha + src2 * beta + gamma
dst(idx) = src1(idx) & src2(idx)
dst(idx) = src(idx) & value
dst(idx) = src1(idx) | src2(idx)
dst(idx) = src(idx) | value
dst(idx) = src1(idx) ^ src2(idx)
dst(idx) = src(idx) ^ value
dst(idx) = ~src(idx)
dst(idx) = lower(idx) <= src(idx) < upper(idx)
dst(idx) = lower <= src(idx) < upper
The comparison operation support single-channel arrays only. Destination image should be 8uC1 or 8sC1 dst(idx) = src1(idx) cmp_op src2(idx)
dst(idx) = src1(idx) cmp_op value
dst(idx) = min(src1(idx),src2(idx))
dst(idx) = max(src1(idx),src2(idx))
dst(idx) = min(src(idx),value)
dst(idx) = max(src(idx),value)
dst(x,y,c) = abs(src1(x,y,c) - src2(x,y,c))
dst(x,y,c) = abs(src(x,y,c) - value(c))
Does cartesian->polar coordinates conversion. Either of output components (magnitude or angle) is optional
Does polar->cartesian coordinates conversion. Either of output components (magnitude or angle) is optional. If magnitude is missing it is assumed to be all 1's
Does powering: dst(idx) = src(idx)^power
Does exponention: dst(idx) = exp(src(idx)). Overflow is not handled yet. Underflow is handled. Maximal relative error is ~7e-6 for single-precision input
Calculates natural logarithms: dst(idx) = log(abs(src(idx))). Logarithm of 0 gives large negative number(~-700) Maximal relative error is ~3e-7 for single-precision output
The function fills the destination array with uniformly or normally distributed random numbers.
rng | CvRNG state initialized by cvRNG |
arr | The destination array |
dist_type | Distribution type
|
param1 | The first parameter of the distribution. In the case of a uniform distribution it is the inclusive lower boundary of the random numbers range. In the case of a normal distribution it is the mean value of the random numbers. |
param2 | The second parameter of the distribution. In the case of a uniform distribution it is the exclusive upper boundary of the random numbers range. In the case of a normal distribution it is the standard deviation of the random numbers. |
Finds all real and complex roots of a polynomial equation
The function calculates the cross product of two 3D vectors:
or:
src1 | The first source vector |
src2 | The second source vector |
dst | The destination vector |
Extended matrix transform: dst = alpha*op(A)*op(B) + beta*op(C), where op(X) is X or X^T
Transforms each element of source array and stores resultant vectors in destination array
Does perspective transform on every element of input array
Calculates (A-delta)*(A-delta)^T (order=0) or (A-delta)^T*(A-delta) (order=1)
Transposes matrix. Square matrices can be transposed in-place
Completes the symmetric matrix from the lower (LtoR=0) or from the upper (LtoR!=0) part
Mirror array data around horizontal (flip=0), vertical (flip=1) or both(flip=-1) axises: cvFlip(src) flips images vertically and sequences horizontally (inplace)
Performs Singular Value Decomposition of a matrix
Performs Singular Value Back Substitution (solves A*X = B): flags must be the same as in cvSVD
Finds eigen values and vectors of a symmetric matrix
Calculates covariation matrix for a set of vectors
Calculates mean and standard deviation of pixel values
Finds global minimum, maximum and their positions
Discrete Fourier Transform: complex->complex, real->ccs (forward), ccs->real (inverse)
Multiply results of DFTs: DFT(X)*DFT(Y) or DFT(X)*conj(DFT(Y))
Discrete Cosine Transform
Releases memory storage. All the children of a parent must be released before the parent. A child storage returns all the blocks to parent when it is released
Clears memory storage. This is the only way(!!!) (besides cvRestoreMemStoragePos) to reuse memory allocated for the storage - cvClearSeq,cvClearSet ... do not free any memory. A child storage returns all the blocks to the parent when it is cleared
Remember a storage "free memory" position
Restore a storage "free memory" position
Changes default size (granularity) of sequence blocks. The default size is ~1Kbyte
Removes the last element from sequence and optionally saves it
Removes the first element from sequence and optioanally saves it
Adds several new elements to the end of sequence
Removes several elements from the end of sequence and optionally saves them
Removes specified sequence element
Removes all the elements from the sequence. The freed memory can be reused later only by the same sequence unless cvClearMemStorage or cvRestoreMemStoragePos is called
Initializes sequence writer. The new elements will be added to the end of sequence
Combination of cvCreateSeq and cvStartAppendToSeq
Updates sequence header. May be useful to get access to some of previously written elements via cvGetSeqElem or sequence reader
Initializes sequence reader. The sequence can be read in forward or backward direction
Changes sequence reader position. It may seek to an absolute or to relative to the current position
Removes sequence slice
Inserts a sequence or array into another sequence
Sorts sequence in-place given element comparison function
Reverses order of sequence elements in-place
Removes element from the set by its index
Removes all the elements from the set
Remove edge connecting two vertices
Remove all vertices and edges from the graph
Releases graph scanner.
Does look-up transformation. Elements of the source array (that should be 8uC1 or 8sC1) are used as indexes in lutarr 256-element table
Inserts sequence into tree with specified "parent" sequence. If parent is equal to frame (e.g. the most external contour), then added contour will have null pointer to parent.
Removes contour from tree (together with the contour children).
Normally, the function is not called directly. Instead, a simple macro CV_TURN_ON_IPL_COMPATIBILITY() is used that calls cvSetIPLAllocators and passes there pointers to IPL allocation functions. :
create_header | pointer to a function, creating IPL image header. |
allocate_data | pointer to a function, allocating IPL image data. |
deallocate | pointer to a function, deallocating IPL image. |
create_roi | pointer to a function, creating IPL image ROI (i.e. Region of Interest). |
clone_image | pointer to a function, cloning an IPL image. |
The function finds the type of a given object and calls release with the double pointer.
struct_ptr | Double pointer to the object |
Sets error status silently
Sets error status and performs some additional actions (displaying message box, writing message to stderr, terminating application etc.) depending on the current error mode
int apiPreference |
int fourcc |
int double fps |
int double CvSize frame_size |
const IplImage* image |
int property_id |
int double value |