OpenCV453
|
型定義 | |
typedef struct CvCapture | CvCapture |
"black box" capture structure [詳解] | |
typedef struct CvVideoWriter | CvVideoWriter |
"black box" video file writer structure [詳解] | |
関数 | |
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)) |
変数 | |
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
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 | ( | 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
close video file writer
Draws contour outlines or filled interiors on the image
Calculates bounding box of text stroke (useful for alignment)
Renders text stroke with specified font and color at specified location. CvFont should be initialized with cvInitFont
Initializes font structure (OpenCV 1.x API).
Draws one or more polygonal curves
Fills an area bounded by one or more arbitrary polygons
Fills convex or monotonous polygon.
Draws ellipse outline, filled ellipse, elliptic arc or filled elliptic sector
Draws a circle with specified center and radius.
Draws a rectangle specified by a CvRect structure
Draws a rectangle given two opposite corners of the rectangle (pt1 & pt2)
Draws 4-connected, 8-connected or antialiased line segment connecting two points
Fits a line into set of 2d or 3d points in a robust way (M-estimator technique)
Finds a sparse set of points within the selected region that seem to be easy to track
Adjust corner position using some sort of gradient search
Harris corner detector:
Calculates minimal eigenvalue for 2x2 gradient covariation matrix at every image pixel
Calculates eigen values and vectors of 2x2 gradient covariation matrix at every image pixel
Calculates constraint image for corner detection
Runs canny edge detector
Fills the connected component until the color difference gets large enough
Applies adaptive threshold to grayscale image.
Applies distance transform to binary image
equalizes histogram of 8-bit single-channel image
Divides one histogram by another.
Locates a template within an image by using a histogram comparison.
Calculates back project
Calculates array histogram
Calculates bayesian probabilistic histograms (each or src and dst is an array of number histograms
Copies a histogram.
Thresholds the histogram.
Normalizes the histogram.
Finds the minimum and maximum histogram bins.
Clears the histogram.
Releases the histogram.
Sets the bounds of the histogram bins.
Finds coordinates of the box vertices
Initializes Freeman chain reader.
Substitutes the last retrieved contour with the new one
Measures similarity between template and overlapped windows in the source image and fills the resultant image with the measurements
Retrieves quadrangle from the input array.
Retrieves the rectangular image region with specified center from the input array.
Calculates 7 Hu's invariants from precalculated spatial and central moments
Calculates all spatial and central moments up to the 3rd order
Performs complex morphological transformation
dilates input image (applies maximum filter) one or more times.
erodes input image (applies minimum filter) one or more times. If element pointer is NULL, 3x3 rectangular element is used
releases structuring element
Performs forward or inverse log-polar image transform
Converts mapx & mapy from floating-point to integer formats for cvRemap
Performs generic geometric transformation using the specified coordinate maps
Warps image with perspective (projective) transform
Warps image with affine transform
Resizes image (input array is resized to fit the destination array)
Converts input array pixels from one color space to another
Calculates the image Laplacian: (d2/dx + d2/dy)I
Calculates an image derivative using generalized Sobel
Segments image using seed "markers"
Filters image using meanshift algorithm
Releases pyramid
Up-samples image and smoothes the result with gaussian kernel.
Smoothes the input image with gaussian kernel and then down-samples it.
Finds integral image: SUM(X,Y) = sum(x<X,y<Y)I(x,y)
Convolves an image with the kernel.
Smooths the image in one of several ways.
Adds image to accumulator with weights: acc = acc*(1-alpha) + image*alpha
Adds a product of two images to accumulator
Adds squared image to accumulator
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 |
これはオーバーロードされたメンバ関数です。利便性のために用意されています。元の関数との違いは引き数のみです。
これはオーバーロードされたメンバ関数です。利便性のために用意されています。元の関数との違いは引き数のみです。
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
Copies source 2D array inside of the larger destination array and makes a border of the specified type (IPL_BORDER_*) around the copied area.
src | The source image |
dst | The destination image |
smoothtype | Type of the smoothing, see SmoothMethod_c |
size1 | The first parameter of the smoothing operation, the aperture width. Must be a positive odd number (1, 3, 5, ...) |
size2 | The second parameter of the smoothing operation, the aperture height. Ignored by CV_MEDIAN and CV_BILATERAL methods. In the case of simple scaled/non-scaled and Gaussian blur if size2 is zero, it is set to size1. Otherwise it must be a positive odd number. |
sigma1 | In the case of a Gaussian parameter this parameter may specify Gaussian ![]()
![]() ![]() |
sigma2 | additional parameter for bilateral filtering |
src | input image. |
dst | output image of the same size and the same number of channels as src. |
kernel | convolution kernel (or rather a correlation kernel), a single-channel floating point matrix; if you want to apply different kernels to different channels, split the image into separate color planes using split and process them individually. |
anchor | anchor of the kernel that indicates the relative position of a filtered point within the kernel; the anchor should lie within the kernel; default value (-1,-1) means that the anchor is at the kernel center. |
dst_width = floor(src_width/2)[+1], dst_height = floor(src_height/2)[+1]
dst_width = src_width*2, dst_height = src_height*2
(aperture_size = 1,3,5,7) or Scharr (aperture_size = -1) operator. Scharr can be used only for the first dx or dy derivative
Performs forward or inverse linear-polar image transform
If element pointer is NULL, 3x3 rectangular element is used
dst(x,y) <- src(x + center.x - dst_width/2, y + center.y - dst_height/2). Values of pixels with fractional coordinates are retrieved using bilinear interpolation
matrixarr = ( a11 a12 | b1 ) dst(x,y) <- src(A[x y]' + b) ( a21 a22 | b2 ) (bilinear interpolation is used to retrieve pixels with fractional coordinates)
(if the substitutor is null, the last retrieved contour is removed from the tree)
The reader is used to iteratively get coordinates of all the chain points. If the Freeman codes should be read as is, a simple sequence reader should be used
This is a standalone function for setting bin ranges in the histogram. For a more detailed description of the parameters ranges and uniform, see the :ocvCalcHist function that can initialize the ranges as well. Ranges for the histogram bins must be set before the histogram is calculated or the backproject of the histogram is calculated.
hist | Histogram. |
ranges | Array of bin ranges arrays. See :ocvCreateHist for details. |
uniform | Uniformity flag. See :ocvCreateHist for details. |
The function releases the histogram (header and the data). The pointer to the histogram is cleared by the function. If *hist pointer is already NULL, the function does nothing.
hist | Double pointer to the released histogram. |
The function sets all of the histogram bins to 0 in case of a dense histogram and removes all histogram bins in case of a sparse array.
hist | Histogram. |
The function finds the minimum and maximum histogram bins and their positions. All of output arguments are optional. Among several extremas with the same value the ones with the minimum index (in the lexicographical order) are returned. In case of several maximums or minimums, the earliest in the lexicographical order (extrema locations) is returned.
hist | Histogram. |
min_value | Pointer to the minimum value of the histogram. |
max_value | Pointer to the maximum value of the histogram. |
min_idx | Pointer to the array of coordinates for the minimum. |
max_idx | Pointer to the array of coordinates for the maximum. |
The function normalizes the histogram bins by scaling them so that the sum of the bins becomes equal to factor.
hist | Pointer to the histogram. |
factor | Normalization factor. |
The function clears histogram bins that are below the specified threshold.
hist | Pointer to the histogram. |
threshold | Threshold level. |
The function makes a copy of the histogram. If the second histogram pointer *dst is NULL, a new histogram of the same size as src is created. Otherwise, both histograms must have equal types and sizes. Then the function copies the bin values of the source histogram to the destination histogram and sets the same bin value ranges as in src.
src | Source histogram. |
dst | Pointer to the destination histogram. |
The function calculates the back projection by comparing histograms of the source image patches with the given histogram. The function is similar to matchTemplate, but instead of comparing the raster patch with all its possible positions within the search window, the function CalcBackProjectPatch compares histograms. See the algorithm diagram below:
image | Source images (though, you may pass CvMat** as well). |
dst | Destination image. |
range | |
hist | Histogram. |
method | Comparison method passed to cvCompareHist (see the function description). |
factor | Normalization factor for histograms that affects the normalization scale of the destination image. Pass 1 if not sure. |
The function calculates the object probability density from two histograms as:
hist1 | First histogram (the divisor). |
hist2 | Second histogram. |
dst_hist | Destination histogram. |
scale | Scale factor for the destination histogram. |
The two parameters for methods CV_ADAPTIVE_THRESH_MEAN_C and CV_ADAPTIVE_THRESH_GAUSSIAN_C are: neighborhood size (3, 5, 7 etc.), and a constant subtracted from mean (...,-3,-2,-1,0,1,2,3,...)
Dx^2 * Dyy + Dxx * Dy^2 - 2 * Dx * Dy * Dxy. Applying threshold to the result gives coordinates of corners
Calculates det(M) - k*(trace(M)^2), where M is 2x2 gradient covariation matrix for each pixel
if thickness<0 (e.g. thickness == CV_FILLED), the filled box is drawn
Thickness works in the same way as with cvRectangle
depending on thickness, start_angle and end_angle parameters. The resultant figure is rotated by angle. All the angles are in degrees
The function initializes the font structure that can be passed to text rendering functions.
font | Pointer to the font structure initialized by the function |
font_face | Font name identifier. See cv::HersheyFonts and corresponding old CV_* identifiers. |
hscale | Horizontal scale. If equal to 1.0f , the characters have the original width depending on the font type. If equal to 0.5f , the characters are of half the original width. |
vscale | Vertical scale. If equal to 1.0f , the characters have the original height depending on the font type. If equal to 0.5f , the characters are of half the original height. |
shear | Approximate tangent of the character slope relative to the vertical line. A zero value means a non-italic font, 1.0f means about a 45 degree slope, etc. |
thickness | Thickness of the text strokes |
line_type | Type of the strokes, see line description |