EstervQrCode 2.0.0
Library for qr code manipulation
Loading...
Searching...
No Matches
Typedefs | Functions | Variables
C API for video I/O

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 IplImageimage
 

Obsolete functions/synonyms

#define cvCaptureFromCAM   cvCreateCameraCapture
 
#define cvCaptureFromFile   cvCreateFileCapture
 
#define cvCaptureFromAVI   cvCaptureFromFile
 
#define cvCreateAVIWriter   cvCreateVideoWriter
 
#define cvWriteToAVI   cvWriteFrame
 

Detailed Description

Macro Definition Documentation

◆ cvCaptureFromAVI

#define cvCaptureFromAVI   cvCaptureFromFile
Deprecated:
use cvCreateFileCapture() instead

◆ cvCaptureFromCAM

#define cvCaptureFromCAM   cvCreateCameraCapture
Deprecated:
use cvCreateCameraCapture() instead

◆ cvCaptureFromFile

#define cvCaptureFromFile   cvCreateFileCapture
Deprecated:
use cvCreateFileCapture() instead

◆ cvCreateAVIWriter

#define cvCreateAVIWriter   cvCreateVideoWriter
Deprecated:
use cvCreateVideoWriter() instead

◆ cvWriteToAVI

#define cvWriteToAVI   cvWriteFrame
Deprecated:
use cvWriteFrame() instead

Typedef Documentation

◆ CvCapture

typedef struct CvCapture CvCapture

"black box" capture structure

In C++ use cv::VideoCapture

◆ CvVideoWriter

typedef struct CvVideoWriter CvVideoWriter

"black box" video file writer structure

In C++ use cv::VideoWriter

Function Documentation

◆ CV_DEFAULT() [1/2]

int streamIdx CV_DEFAULT ( )

◆ CV_DEFAULT() [2/2]

int double CvSize int is_color CV_DEFAULT ( )

◆ CVAPI() [1/6]

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() [2/6]

CVAPI ( CvVideoWriter *  ) const

initialize video file writer

◆ CVAPI() [3/6]

CVAPI ( double  )

retrieve capture properties

◆ CVAPI() [4/6]

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() [5/6]

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.

Warning
!!!DO NOT RELEASE or MODIFY the retrieved frame!!!
!!!DO NOT RELEASE or MODIFY the retrieved frame!!!

◆ CVAPI() [6/6]

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 :

if(image )
{
iplDeallocate(*image, IPL_IMAGE_HEADER | IPL_IMAGE_ROI);
*image = 0;
}
#define IPL_IMAGE_ROI
Definition types_c.h:401
#define IPL_IMAGE_HEADER
Definition types_c.h:399
const IplImage * image
Definition videoio_c.h:131

but it does not use IPL functions by default (see the CV_TURN_ON_IPL_COMPATIBILITY macro).

Parameters
imageDouble pointer to the image header

This call is a shortened form of :

if(*image )
{
cvReleaseData(*image);
cvReleaseImageHeader(image);
}
Parameters
imageDouble 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.

Parameters
imageA pointer to the image header
coiThe 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.

Parameters
imageA pointer to the image header
rectThe ROI rectangle

This produces a similar result to the following, but in addition it releases the ROI structure. :

cvSetImageROI(image, cvRect(0, 0, image->width, image->height ));
cvSetImageCOI(image, 0);
CV_INLINE CvRect cvRect(int x, int y, int width, int height)
Definition types_c.h:862
int height
Definition types_c.h:330
int width
Definition types_c.h:329
Parameters
imageA 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. :

if(*mat )
cvFree((void**)mat);
#define cvFree(ptr)
Definition core_c.h:92
CvArr const CvMat * mat
Definition core_c.h:1308
CV_INLINE void cvDecRefData(CvArr *arr)
Decrements an array data reference counter.
Definition core_c.h:301
Parameters
matDouble pointer to the matrix

low-level scalar <-> raw data conversion functions

The function releases the sparse array and clears the array pointer upon exit.

Parameters
matDouble 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.

Parameters
arrInput array
idx0The first zero-based component of the element index
valueThe 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.

Parameters
arrInput array
idxArray of the element indices
valueThe 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.

Parameters
arrInput array
idx0The first zero-based component of the element index
valueThe 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.

Parameters
arrArray 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 .

Parameters
arrArray header

The function assigns user data to the array header. Header should be initialized before using cvCreateMatHeader, cvCreateImageHeader, cvCreateMatNDHeader, cvInitMatHeader, cvInitImageHeader or cvInitMatNDHeader.

Parameters
arrArray header
dataUser data
stepFull 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 :

float* data;
int step;
cvGetRawData(array, (uchar**)&data, &step, &size);
step /= sizeof(data[0]);
for(int y = 0; y < size.height; y++, data += step )
for(int x = 0; x < size.width; x++ )
data[x] = (float)fabs(data[x]);
CvSize size
Definition core_c.h:112
void int step
Definition core_c.h:905
void * data
Definition core_c.h:427
const CvArr CvArr * x
Definition core_c.h:1195
const CvArr * y
Definition core_c.h:1187
unsigned char uchar
Definition interface.h:51
Definition types_c.h:1158
int width
Definition types_c.h:1159
int height
Definition types_c.h:1160
Parameters
arrArray header
dataOutput pointer to the whole image origin or ROI origin if ROI is set
stepOutput full row length in bytes
roi_sizeOutput ROI size

The function copies selected elements from an input array to an output array:

\[\texttt{dst} (I)= \texttt{src} (I)  \quad \text{if} \quad \texttt{mask} (I)  \ne 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).

Parameters
srcThe source array
dstThe destination array
maskOperation 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:

\[\texttt{arr} (I)= \texttt{value} \quad \text{if} \quad \texttt{mask} (I)  \ne 0\]

If array arr is of IplImage type, then is ROI used, but COI must not be set.

Parameters
arrThe destination array
valueFill value
maskOperation 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.

Parameters
arrArray 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:

\[\texttt{dst} (I) =  \texttt{scale} \texttt{src} (I) + ( \texttt{shift} _0, \texttt{shift} _1,...)\]

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.

Parameters
srcSource array
dstDestination array
scaleScale factor
shiftValue 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.

Parameters
rngCvRNG state initialized by cvRNG
arrThe destination array
dist_typeDistribution type

‍- CV_RAND_UNI uniform distribution

  • CV_RAND_NORMAL normal or Gaussian distribution
param1The 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.
param2The 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.
See also
randu, randn, RNG::fill.

Finds all real and complex roots of a polynomial equation

The function calculates the cross product of two 3D vectors:

\[\texttt{dst} =  \texttt{src1} \times \texttt{src2}\]

or:

\[\begin{array}{l} \texttt{dst} _1 =  \texttt{src1} _2  \texttt{src2} _3 -  \texttt{src1} _3  \texttt{src2} _2 \\ \texttt{dst} _2 =  \texttt{src1} _3  \texttt{src2} _1 -  \texttt{src1} _1  \texttt{src2} _3 \\ \texttt{dst} _3 =  \texttt{src1} _1  \texttt{src2} _2 -  \texttt{src1} _2  \texttt{src2} _1 \end{array}\]

Parameters
src1The first source vector
src2The second source vector
dstThe 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

  • Finds selected eigen values and vectors of a symmetric matrix *‍/ Makes an identity matrix (mat_ij = i == j)

Calculates covariation matrix for a set of vectors

See also
flags

Calculates mean and standard deviation of pixel values

Finds global minimum, maximum and their positions

See also
ref core_c_NormFlags "flags"
flags

Discrete Fourier Transform: complex->complex, real->ccs (forward), ccs->real (inverse)

See also
core_c_DftFlags "flags"

Multiply results of DFTs: DFT(X)*DFT(Y) or DFT(X)*conj(DFT(Y))

See also
core_c_DftFlags "flags"

Discrete Cosine Transform

See also
core_c_DftFlags "flags"

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. :

...
CV_TURN_ON_IPL_COMPATIBILITY()
...
Parameters
create_headerpointer to a function, creating IPL image header.
allocate_datapointer to a function, allocating IPL image data.
deallocatepointer to a function, deallocating IPL image.
create_roipointer to a function, creating IPL image ROI (i.e. Region of Interest).
clone_imagepointer to a function, cloning an IPL image.

The function finds the type of a given object and calls release with the double pointer.

Parameters
struct_ptrDouble 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

Variable Documentation

◆ apiPreference

int apiPreference

◆ fourcc

int fourcc

◆ fps

int double fps

◆ frame_size

int double CvSize frame_size

◆ image

const IplImage* image

◆ property_id

int property_id

◆ value

int double value