📄 cxcore.h
字号:
/* dst(x,y,c) = abs(src1(x,y,c) - src2(x,y,c)) */
CVAPI(void) cvAbsDiff( const CvArr* src1, const CvArr* src2, CvArr* dst );
/* dst(x,y,c) = abs(src(x,y,c) - value(c)) */
CVAPI(void) cvAbsDiffS( const CvArr* src, CvArr* dst, CvScalar value );
#define cvAbs( src, dst ) cvAbsDiffS( (src), (dst), cvScalarAll(0))
/****************************************************************************************\
* Math operations *
\****************************************************************************************/
/* Does cartesian->polar coordinates conversion.
Either of output components (magnitude or angle) is optional */
CVAPI(void) cvCartToPolar( const CvArr* x, const CvArr* y,
CvArr* magnitude, CvArr* angle CV_DEFAULT(NULL),
int angle_in_degrees CV_DEFAULT(0));
/* 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 */
CVAPI(void) cvPolarToCart( const CvArr* magnitude, const CvArr* angle,
CvArr* x, CvArr* y,
int angle_in_degrees CV_DEFAULT(0));
/* Does powering: dst(idx) = src(idx)^power */
CVAPI(void) cvPow( const CvArr* src, CvArr* dst, double 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 */
CVAPI(void) cvExp( const CvArr* src, CvArr* dst );
/* 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
*/
CVAPI(void) cvLog( const CvArr* src, CvArr* dst );
/* Fast arctangent calculation */
CVAPI(float) cvFastArctan( float y, float x );
/* Fast cubic root calculation */
CVAPI(float) cvCbrt( float value );
/* Checks array values for NaNs, Infs or simply for too large numbers
(if CV_CHECK_RANGE is set). If CV_CHECK_QUIET is set,
no runtime errors is raised (function returns zero value in case of "bad" values).
Otherwise cvError is called */
#define CV_CHECK_RANGE 1
#define CV_CHECK_QUIET 2
CVAPI(int) cvCheckArr( const CvArr* arr, int flags CV_DEFAULT(0),
double min_val CV_DEFAULT(0), double max_val CV_DEFAULT(0));
#define cvCheckArray cvCheckArr
#define CV_RAND_UNI 0
#define CV_RAND_NORMAL 1
CVAPI(void) cvRandArr( CvRNG* rng, CvArr* arr, int dist_type,
CvScalar param1, CvScalar param2 );
/****************************************************************************************\
* Matrix operations *
\****************************************************************************************/
/* Calculates cross product of two 3d vectors */
CVAPI(void) cvCrossProduct( const CvArr* src1, const CvArr* src2, CvArr* dst );
/* Matrix transform: dst = A*B + C, C is optional */
#define cvMatMulAdd( src1, src2, src3, dst ) cvGEMM( (src1), (src2), 1., (src3), 1., (dst), 0 )
#define cvMatMul( src1, src2, dst ) cvMatMulAdd( (src1), (src2), NULL, (dst))
#define CV_GEMM_A_T 1
#define CV_GEMM_B_T 2
#define CV_GEMM_C_T 4
/* Extended matrix transform:
dst = alpha*op(A)*op(B) + beta*op(C), where op(X) is X or X^T */
CVAPI(void) cvGEMM( const CvArr* src1, const CvArr* src2, double alpha,
const CvArr* src3, double beta, CvArr* dst,
int tABC CV_DEFAULT(0));
#define cvMatMulAddEx cvGEMM
/* Transforms each element of source array and stores
resultant vectors in destination array */
CVAPI(void) cvTransform( const CvArr* src, CvArr* dst,
const CvMat* transmat,
const CvMat* shiftvec CV_DEFAULT(NULL));
#define cvMatMulAddS cvTransform
/* Does perspective transform on every element of input array */
CVAPI(void) cvPerspectiveTransform( const CvArr* src, CvArr* dst,
const CvMat* mat );
/* Calculates (A-delta)*(A-delta)^T (order=0) or (A-delta)^T*(A-delta) (order=1) */
CVAPI(void) cvMulTransposed( const CvArr* src, CvArr* dst, int order,
const CvArr* delta CV_DEFAULT(NULL) );
/* Tranposes matrix. Square matrices can be transposed in-place */
CVAPI(void) cvTranspose( const CvArr* src, CvArr* dst );
#define cvT cvTranspose
/* Mirror array data around horizontal (flip=0),
vertical (flip=1) or both(flip=-1) axises:
cvFlip(src) flips images vertically and sequences horizontally (inplace) */
CVAPI(void) cvFlip( const CvArr* src, CvArr* dst CV_DEFAULT(NULL),
int flip_mode CV_DEFAULT(0));
#define cvMirror cvFlip
#define CV_SVD_MODIFY_A 1
#define CV_SVD_U_T 2
#define CV_SVD_V_T 4
/* Performs Singular Value Decomposition of a matrix */
CVAPI(void) cvSVD( CvArr* A, CvArr* W, CvArr* U CV_DEFAULT(NULL),
CvArr* V CV_DEFAULT(NULL), int flags CV_DEFAULT(0));
/* Performs Singular Value Back Substitution (solves A*X = B):
flags must be the same as in cvSVD */
CVAPI(void) cvSVBkSb( const CvArr* W, const CvArr* U,
const CvArr* V, const CvArr* B,
CvArr* X, int flags );
#define CV_LU 0
#define CV_SVD 1
#define CV_SVD_SYM 2
/* Inverts matrix */
CVAPI(double) cvInvert( const CvArr* src, CvArr* dst,
int method CV_DEFAULT(CV_LU));
#define cvInv cvInvert
/* Solves linear system (src1)*(dst) = (src2)
(returns 0 if src1 is a singular and CV_LU method is used) */
CVAPI(int) cvSolve( const CvArr* src1, const CvArr* src2, CvArr* dst,
int method CV_DEFAULT(CV_LU));
/* Calculates determinant of input matrix */
CVAPI(double) cvDet( const CvArr* mat );
/* Calculates trace of the matrix (sum of elements on the main diagonal) */
CVAPI(CvScalar) cvTrace( const CvArr* mat );
/* Finds eigen values and vectors of a symmetric matrix */
CVAPI(void) cvEigenVV( CvArr* mat, CvArr* evects,
CvArr* evals, double eps CV_DEFAULT(0));
/* Makes an identity matrix (mat_ij = i == j) */
CVAPI(void) cvSetIdentity( CvArr* mat, CvScalar value CV_DEFAULT(cvRealScalar(1)) );
/* Calculates covariation matrix for a set of vectors */
/* transpose([v1-avg, v2-avg,...]) * [v1-avg,v2-avg,...] */
#define CV_COVAR_SCRAMBLED 0
/* [v1-avg, v2-avg,...] * transpose([v1-avg,v2-avg,...]) */
#define CV_COVAR_NORMAL 1
/* do not calc average (i.e. mean vector) - use the input vector instead
(useful for calculating covariance matrix by parts) */
#define CV_COVAR_USE_AVG 2
/* scale the covariance matrix coefficients by number of the vectors */
#define CV_COVAR_SCALE 4
CVAPI(void) cvCalcCovarMatrix( const CvArr** vects, int count,
CvArr* cov_mat, CvArr* avg, int flags );
/* Calculates Mahalanobis(weighted) distance */
CVAPI(double) cvMahalanobis( const CvArr* vec1, const CvArr* vec2, CvArr* mat );
#define cvMahalonobis cvMahalanobis
/****************************************************************************************\
* Array Statistics *
\****************************************************************************************/
/* Finds sum of array elements */
CVAPI(CvScalar) cvSum( const CvArr* arr );
/* Calculates number of non-zero pixels */
CVAPI(int) cvCountNonZero( const CvArr* arr );
/* Calculates mean value of array elements */
CVAPI(CvScalar) cvAvg( const CvArr* arr, const CvArr* mask CV_DEFAULT(NULL) );
/* Calculates mean and standard deviation of pixel values */
CVAPI(void) cvAvgSdv( const CvArr* arr, CvScalar* mean, CvScalar* std_dev,
const CvArr* mask CV_DEFAULT(NULL) );
/* Finds global minimum, maximum and their positions */
CVAPI(void) cvMinMaxLoc( const CvArr* arr, double* min_val, double* max_val,
CvPoint* min_loc CV_DEFAULT(NULL),
CvPoint* max_loc CV_DEFAULT(NULL),
const CvArr* mask CV_DEFAULT(NULL) );
/* types of array norm */
#define CV_C 1
#define CV_L1 2
#define CV_L2 4
#define CV_NORM_MASK 7
#define CV_RELATIVE 8
#define CV_DIFF 16
#define CV_DIFF_C (CV_DIFF | CV_C)
#define CV_DIFF_L1 (CV_DIFF | CV_L1)
#define CV_DIFF_L2 (CV_DIFF | CV_L2)
#define CV_RELATIVE_C (CV_RELATIVE | CV_C)
#define CV_RELATIVE_L1 (CV_RELATIVE | CV_L1)
#define CV_RELATIVE_L2 (CV_RELATIVE | CV_L2)
/* Finds norm, difference norm or relative difference norm for an array (or two arrays) */
CVAPI(double) cvNorm( const CvArr* arr1, const CvArr* arr2 CV_DEFAULT(NULL),
int norm_type CV_DEFAULT(CV_L2),
const CvArr* mask CV_DEFAULT(NULL) );
/****************************************************************************************\
* Discrete Linear Transforms *
\****************************************************************************************/
#define CV_DXT_FORWARD 0
#define CV_DXT_INVERSE 1
#define CV_DXT_SCALE 2 /* divide result by size of array */
#define CV_DXT_INV_SCALE (CV_DXT_INVERSE + CV_DXT_SCALE)
#define CV_DXT_INVERSE_SCALE CV_DXT_INV_SCALE
#define CV_DXT_ROWS 4 /* transform each row individually */
#define CV_DXT_MUL_CONJ 8 /* conjugate the second argument of cvMulSpectrums */
/* Discrete Fourier Transform:
complex->complex,
real->ccs (forward),
ccs->real (inverse) */
CVAPI(void) cvDFT( const CvArr* src, CvArr* dst, int flags );
#define cvFFT cvDFT
/* Multiply results of DFTs: DFT(X)*DFT(Y) or DFT(X)*conj(DFT(Y)) */
CVAPI(void) cvMulSpectrums( const CvArr* src1, const CvArr* src2,
CvArr* dst, int flags );
/* Discrete Cosine Transform */
CVAPI(void) cvDCT( const CvArr* src, CvArr* dst, int flags );
/****************************************************************************************\
* Dynamic data structures *
\****************************************************************************************/
/* Calculates length of sequence slice (with support of negative indices). */
CVAPI(int) cvSliceLength( CvSlice slice, const CvSeq* seq );
/* Creates new memory storage.
block_size == 0 means that default,
somewhat optimal size, is used (currently, it is 64K) */
CVAPI(CvMemStorage*) cvCreateMemStorage( int block_size CV_DEFAULT(0));
/* Creates a memory storage that will borrow memory blocks from parent storage */
CVAPI(CvMemStorage*) cvCreateChildMemStorage( CvMemStorage* parent );
/* 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 */
CVAPI(void) cvReleaseMemStorage( CvMemStorage** storage );
/* 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 */
CVAPI(void) cvClearMemStorage( CvMemStorage* storage );
/* Remember a storage "free memory" position */
CVAPI(void) cvSaveMemStoragePos( const CvMemStorage* storage, CvMemStoragePos* pos );
/* Restore a storage "free memory" position */
CVAPI(void) cvRestoreMemStoragePos( CvMemStorage* storage, CvMemStoragePos* pos );
/* Allocates continuous buffer of the specified size in the storage */
CVAPI(void*) cvMemStorageAlloc( CvMemStorage* storage, size_t size );
/* Allocates string in memory storage */
CVAPI(CvString) cvMemStorageAllocString( CvMemStorage* storage, const char* ptr,
int len CV_DEFAULT(-1) );
/* Creates new empty sequence that will reside in the specified storage */
CVAPI(CvSeq*) cvCreateSeq( int seq_flags, int header_size,
int elem_size, CvMemStorage* storage );
/* Changes default size (granularity) of sequence blocks.
The default size is ~1Kbyte */
CVAPI(void) cvSetSeqBlockSize( CvSeq* seq, int delta_elems );
/* Adds new element to the end of sequence. Returns pointer to the element */
CVAPI(char*) cvSeqPush( CvSeq* seq, void* element CV_DEFAULT(NULL));
/* Adds new element to the beginning of sequence. Returns pointer to it */
CVAPI(char*) cvSeqPushFront( CvSeq* seq, void* element CV_DEFAULT(NULL));
/* Removes the last element from sequence and optionally saves it */
CVAPI(void) cvSeqPop( CvSeq* seq, void* element CV_DEFAULT(NULL));
/* Removes the first element from sequence and optioanally saves it */
CVAPI(void) cvSeqPopFront( CvSeq* seq, void* element CV_DEFAULT(NULL));
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -