📄 cxcore.h
字号:
(the function together with cvNextArraySlice is used for
N-ari element-wise operations) */
CVAPI(int) cvInitNArrayIterator( int count, CvArr** arrs,
const CvArr* mask, CvMatND* stubs,
CvNArrayIterator* array_iterator,
int flags CV_DEFAULT(0) );
/* returns zero value if iteration is finished, non-zero (slice length) otherwise */
CVAPI(int) cvNextNArraySlice( CvNArrayIterator* array_iterator );
/* Returns type of array elements:
CV_8UC1 ... CV_64FC4 ... */
CVAPI(int) cvGetElemType( const CvArr* arr );
/* Retrieves number of an array dimensions and
optionally sizes of the dimensions */
CVAPI(int) cvGetDims( const CvArr* arr, int* sizes CV_DEFAULT(NULL) );
/* Retrieves size of a particular array dimension.
For 2d arrays cvGetDimSize(arr,0) returns number of rows (image height)
and cvGetDimSize(arr,1) returns number of columns (image width) */
CVAPI(int) cvGetDimSize( const CvArr* arr, int index );
/* ptr = &arr(idx0,idx1,...). All indexes are zero-based,
the major dimensions go first (e.g. (y,x) for 2D, (z,y,x) for 3D */
CVAPI(uchar*) cvPtr1D( const CvArr* arr, int idx0, int* type CV_DEFAULT(NULL));
CVAPI(uchar*) cvPtr2D( const CvArr* arr, int idx0, int idx1, int* type CV_DEFAULT(NULL) );
CVAPI(uchar*) cvPtr3D( const CvArr* arr, int idx0, int idx1, int idx2,
int* type CV_DEFAULT(NULL));
/* For CvMat or IplImage number of indices should be 2
(row index (y) goes first, column index (x) goes next).
For CvMatND or CvSparseMat number of infices should match number of <dims> and
indices order should match the array dimension order. */
CVAPI(uchar*) cvPtrND( const CvArr* arr, int* idx, int* type CV_DEFAULT(NULL),
int create_node CV_DEFAULT(1),
unsigned* precalc_hashval CV_DEFAULT(NULL));
/* value = arr(idx0,idx1,...) */
CVAPI(CvScalar) cvGet1D( const CvArr* arr, int idx0 );
CVAPI(CvScalar) cvGet2D( const CvArr* arr, int idx0, int idx1 );
CVAPI(CvScalar) cvGet3D( const CvArr* arr, int idx0, int idx1, int idx2 );
CVAPI(CvScalar) cvGetND( const CvArr* arr, int* idx );
/* for 1-channel arrays */
CVAPI(double) cvGetReal1D( const CvArr* arr, int idx0 );
CVAPI(double) cvGetReal2D( const CvArr* arr, int idx0, int idx1 );
CVAPI(double) cvGetReal3D( const CvArr* arr, int idx0, int idx1, int idx2 );
CVAPI(double) cvGetRealND( const CvArr* arr, int* idx );
/* arr(idx0,idx1,...) = value */
CVAPI(void) cvSet1D( CvArr* arr, int idx0, CvScalar value );
CVAPI(void) cvSet2D( CvArr* arr, int idx0, int idx1, CvScalar value );
CVAPI(void) cvSet3D( CvArr* arr, int idx0, int idx1, int idx2, CvScalar value );
CVAPI(void) cvSetND( CvArr* arr, int* idx, CvScalar value );
/* for 1-channel arrays */
CVAPI(void) cvSetReal1D( CvArr* arr, int idx0, double value );
CVAPI(void) cvSetReal2D( CvArr* arr, int idx0, int idx1, double value );
CVAPI(void) cvSetReal3D( CvArr* arr, int idx0,
int idx1, int idx2, double value );
CVAPI(void) cvSetRealND( CvArr* arr, int* idx, double value );
/* clears element of ND dense array,
in case of sparse arrays it deletes the specified node */
CVAPI(void) cvClearND( CvArr* arr, int* idx );
/* Converts CvArr (IplImage or CvMat,...) to CvMat.
If the last parameter is non-zero, function can
convert multi(>2)-dimensional array to CvMat as long as
the last array's dimension is continous. The resultant
matrix will be have appropriate (a huge) number of rows */
CVAPI(CvMat*) cvGetMat( const CvArr* arr, CvMat* header,
int* coi CV_DEFAULT(NULL),
int allowND CV_DEFAULT(0));
/* Converts CvArr (IplImage or CvMat) to IplImage */
CVAPI(IplImage*) cvGetImage( const CvArr* arr, IplImage* image_header );
/* Changes a shape of multi-dimensional array.
new_cn == 0 means that number of channels remains unchanged.
new_dims == 0 means that number and sizes of dimensions remain the same
(unless they need to be changed to set the new number of channels)
if new_dims == 1, there is no need to specify new dimension sizes
The resultant configuration should be achievable w/o data copying.
If the resultant array is sparse, CvSparseMat header should be passed
to the function else if the result is 1 or 2 dimensional,
CvMat header should be passed to the function
else CvMatND header should be passed */
CVAPI(CvArr*) cvReshapeMatND( const CvArr* arr,
int sizeof_header, CvArr* header,
int new_cn, int new_dims, int* new_sizes );
#define cvReshapeND( arr, header, new_cn, new_dims, new_sizes ) \
cvReshapeMatND( (arr), sizeof(*(header)), (header), \
(new_cn), (new_dims), (new_sizes))
CVAPI(CvMat*) cvReshape( const CvArr* arr, CvMat* header,
int new_cn, int new_rows CV_DEFAULT(0) );
/* Repeats source 2d array several times in both horizontal and
vertical direction to fill destination array */
CVAPI(void) cvRepeat( const CvArr* src, CvArr* dst );
/* Allocates array data */
CVAPI(void) cvCreateData( CvArr* arr );
/* Releases array data */
CVAPI(void) cvReleaseData( CvArr* arr );
/* Attaches user data to the array header. The step is reffered to
the pre-last dimension. That is, all the planes of the array
must be joint (w/o gaps) */
CVAPI(void) cvSetData( CvArr* arr, void* data, int step );
/* Retrieves raw data of CvMat, IplImage or CvMatND.
In the latter case the function raises an error if
the array can not be represented as a matrix */
CVAPI(void) cvGetRawData( const CvArr* arr, uchar** data,
int* step CV_DEFAULT(NULL),
CvSize* roi_size CV_DEFAULT(NULL));
/* Returns width and height of array in elements */
CVAPI(CvSize) cvGetSize( const CvArr* arr );
/* Copies source array to destination array */
CVAPI(void) cvCopy( const CvArr* src, CvArr* dst,
const CvArr* mask CV_DEFAULT(NULL) );
/* Sets all or "masked" elements of input array
to the same value*/
CVAPI(void) cvSet( CvArr* arr, CvScalar value,
const CvArr* mask CV_DEFAULT(NULL) );
/* Clears all the array elements (sets them to 0) */
CVAPI(void) cvSetZero( CvArr* arr );
#define cvZero cvSetZero
/* Splits a multi-channel array into the set of single-channel arrays or
extracts particular [color] plane */
CVAPI(void) cvSplit( const CvArr* src, CvArr* dst0, CvArr* dst1,
CvArr* dst2, CvArr* dst3 );
/* Merges a set of single-channel arrays into the single multi-channel array
or inserts one particular [color] plane to the array */
CVAPI(void) cvMerge( const CvArr* src0, const CvArr* src1,
const CvArr* src2, const CvArr* src3,
CvArr* dst );
/* Performs linear transformation on every source array element:
dst(x,y,c) = scale*src(x,y,c)+shift.
Arbitrary combination of input and output array depths are allowed
(number of channels must be the same), thus the function can be used
for type conversion */
CVAPI(void) cvConvertScale( const CvArr* src, CvArr* dst,
double scale CV_DEFAULT(1),
double shift CV_DEFAULT(0) );
#define cvCvtScale cvConvertScale
#define cvScale cvConvertScale
#define cvConvert( src, dst ) cvConvertScale( (src), (dst), 1, 0 )
/* 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 */
CVAPI(void) cvConvertScaleAbs( const CvArr* src, CvArr* dst,
double scale CV_DEFAULT(1),
double shift CV_DEFAULT(0) );
#define cvCvtScaleAbs cvConvertScaleAbs
/* checks termination criteria validity and
sets eps to default_eps (if it is not set),
max_iter to default_max_iters (if it is not set)
*/
CVAPI(CvTermCriteria) cvCheckTermCriteria( CvTermCriteria criteria,
double default_eps,
int default_max_iters );
/****************************************************************************************\
* Arithmetic, logic and comparison operations *
\****************************************************************************************/
/* dst(mask) = src1(mask) + src2(mask) */
CVAPI(void) cvAdd( const CvArr* src1, const CvArr* src2, CvArr* dst,
const CvArr* mask CV_DEFAULT(NULL));
/* dst(mask) = src(mask) + value */
CVAPI(void) cvAddS( const CvArr* src, CvScalar value, CvArr* dst,
const CvArr* mask CV_DEFAULT(NULL));
/* dst(mask) = src1(mask) - src2(mask) */
CVAPI(void) cvSub( const CvArr* src1, const CvArr* src2, CvArr* dst,
const CvArr* mask CV_DEFAULT(NULL));
/* dst(mask) = src(mask) - value = src(mask) + (-value) */
CV_INLINE void cvSubS( const CvArr* src, CvScalar value, CvArr* dst,
const CvArr* mask CV_DEFAULT(NULL));
CV_INLINE void cvSubS( const CvArr* src, CvScalar value, CvArr* dst,
const CvArr* mask )
{
cvAddS( src, cvScalar( -value.val[0], -value.val[1], -value.val[2], -value.val[3]),
dst, mask );
}
/* dst(mask) = value - src(mask) */
CVAPI(void) cvSubRS( const CvArr* src, CvScalar value, CvArr* dst,
const CvArr* mask CV_DEFAULT(NULL));
/* dst(idx) = src1(idx) * src2(idx) * scale
(scaled element-wise multiplication of 2 arrays) */
CVAPI(void) cvMul( const CvArr* src1, const CvArr* src2,
CvArr* dst, double scale CV_DEFAULT(1) );
/* element-wise division/inversion with scaling:
dst(idx) = src1(idx) * scale / src2(idx)
or dst(idx) = scale / src2(idx) if src1 == 0 */
CVAPI(void) cvDiv( const CvArr* src1, const CvArr* src2,
CvArr* dst, double scale CV_DEFAULT(1));
/* dst = src1 * scale + src2 */
CVAPI(void) cvScaleAdd( const CvArr* src1, CvScalar scale,
const CvArr* src2, CvArr* dst );
#define cvAXPY( A, real_scalar, B, C ) cvScaleAdd(A, cvRealScalar(real_scalar), B, C)
/* dst = src1 * alpha + src2 * beta + gamma */
CVAPI(void) cvAddWeighted( const CvArr* src1, double alpha,
const CvArr* src2, double beta,
double gamma, CvArr* dst );
/* result = sum_i(src1(i) * src2(i)) (results for all channels are accumulated together) */
CVAPI(double) cvDotProduct( const CvArr* src1, const CvArr* src2 );
/* dst(idx) = src1(idx) & src2(idx) */
CVAPI(void) cvAnd( const CvArr* src1, const CvArr* src2,
CvArr* dst, const CvArr* mask CV_DEFAULT(NULL));
/* dst(idx) = src(idx) & value */
CVAPI(void) cvAndS( const CvArr* src, CvScalar value,
CvArr* dst, const CvArr* mask CV_DEFAULT(NULL));
/* dst(idx) = src1(idx) | src2(idx) */
CVAPI(void) cvOr( const CvArr* src1, const CvArr* src2,
CvArr* dst, const CvArr* mask CV_DEFAULT(NULL));
/* dst(idx) = src(idx) | value */
CVAPI(void) cvOrS( const CvArr* src, CvScalar value,
CvArr* dst, const CvArr* mask CV_DEFAULT(NULL));
/* dst(idx) = src1(idx) ^ src2(idx) */
CVAPI(void) cvXor( const CvArr* src1, const CvArr* src2,
CvArr* dst, const CvArr* mask CV_DEFAULT(NULL));
/* dst(idx) = src(idx) ^ value */
CVAPI(void) cvXorS( const CvArr* src, CvScalar value,
CvArr* dst, const CvArr* mask CV_DEFAULT(NULL));
/* dst(idx) = ~src(idx) */
CVAPI(void) cvNot( const CvArr* src, CvArr* dst );
/* dst(idx) = lower(idx) <= src(idx) < upper(idx) */
CVAPI(void) cvInRange( const CvArr* src, const CvArr* lower,
const CvArr* upper, CvArr* dst );
/* dst(idx) = lower <= src(idx) < upper */
CVAPI(void) cvInRangeS( const CvArr* src, CvScalar lower,
CvScalar upper, CvArr* dst );
#define CV_CMP_EQ 0
#define CV_CMP_GT 1
#define CV_CMP_GE 2
#define CV_CMP_LT 3
#define CV_CMP_LE 4
#define CV_CMP_NE 5
/* The comparison operation support single-channel arrays only.
Destination image should be 8uC1 or 8sC1 */
/* dst(idx) = src1(idx) _cmp_op_ src2(idx) */
CVAPI(void) cvCmp( const CvArr* src1, const CvArr* src2, CvArr* dst, int cmp_op );
/* dst(idx) = src1(idx) _cmp_op_ value */
CVAPI(void) cvCmpS( const CvArr* src, double value, CvArr* dst, int cmp_op );
/* dst(idx) = min(src1(idx),src2(idx)) */
CVAPI(void) cvMin( const CvArr* src1, const CvArr* src2, CvArr* dst );
/* dst(idx) = max(src1(idx),src2(idx)) */
CVAPI(void) cvMax( const CvArr* src1, const CvArr* src2, CvArr* dst );
/* dst(idx) = min(src(idx),value) */
CVAPI(void) cvMinS( const CvArr* src, double value, CvArr* dst );
/* dst(idx) = max(src(idx),value) */
CVAPI(void) cvMaxS( const CvArr* src, double value, CvArr* dst );
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -