00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044 #ifndef __OPENCV_CORE_C_H__
00045 #define __OPENCV_CORE_C_H__
00046
00047 #include "opencv2/core/types_c.h"
00048
00049 #ifdef __cplusplus
00050 extern "C" {
00051 #endif
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061 CVAPI(void*) cvAlloc( size_t size );
00062
00063
00064
00065
00066
00067
00068
00069 CVAPI(void) cvFree_( void* ptr );
00070 #define cvFree(ptr) (cvFree_(*(ptr)), *(ptr)=0)
00071
00072
00073 CVAPI(IplImage*) cvCreateImageHeader( CvSize size, int depth, int channels );
00074
00075
00076 CVAPI(IplImage*) cvInitImageHeader( IplImage* image, CvSize size, int depth,
00077 int channels, int origin CV_DEFAULT(0),
00078 int align CV_DEFAULT(4));
00079
00080
00081 CVAPI(IplImage*) cvCreateImage( CvSize size, int depth, int channels );
00082
00083
00084 CVAPI(void) cvReleaseImageHeader( IplImage** image );
00085
00086
00087 CVAPI(void) cvReleaseImage( IplImage** image );
00088
00089
00090 CVAPI(IplImage*) cvCloneImage( const IplImage* image );
00091
00092
00093
00094 CVAPI(void) cvSetImageCOI( IplImage* image, int coi );
00095
00096
00097 CVAPI(int) cvGetImageCOI( const IplImage* image );
00098
00099
00100 CVAPI(void) cvSetImageROI( IplImage* image, CvRect rect );
00101
00102
00103 CVAPI(void) cvResetImageROI( IplImage* image );
00104
00105
00106 CVAPI(CvRect) cvGetImageROI( const IplImage* image );
00107
00108
00109 CVAPI(CvMat*) cvCreateMatHeader( int rows, int cols, int type );
00110
00111 #define CV_AUTOSTEP 0x7fffffff
00112
00113
00114 CVAPI(CvMat*) cvInitMatHeader( CvMat* mat, int rows, int cols,
00115 int type, void* data CV_DEFAULT(NULL),
00116 int step CV_DEFAULT(CV_AUTOSTEP) );
00117
00118
00119 CVAPI(CvMat*) cvCreateMat( int rows, int cols, int type );
00120
00121
00122
00123 CVAPI(void) cvReleaseMat( CvMat** mat );
00124
00125
00126
00127 CV_INLINE void cvDecRefData( CvArr* arr )
00128 {
00129 if( CV_IS_MAT( arr ))
00130 {
00131 CvMat* mat = (CvMat*)arr;
00132 mat->data.ptr = NULL;
00133 if( mat->refcount != NULL && --*mat->refcount == 0 )
00134 cvFree( &mat->refcount );
00135 mat->refcount = NULL;
00136 }
00137 else if( CV_IS_MATND( arr ))
00138 {
00139 CvMatND* mat = (CvMatND*)arr;
00140 mat->data.ptr = NULL;
00141 if( mat->refcount != NULL && --*mat->refcount == 0 )
00142 cvFree( &mat->refcount );
00143 mat->refcount = NULL;
00144 }
00145 }
00146
00147
00148 CV_INLINE int cvIncRefData( CvArr* arr )
00149 {
00150 int refcount = 0;
00151 if( CV_IS_MAT( arr ))
00152 {
00153 CvMat* mat = (CvMat*)arr;
00154 if( mat->refcount != NULL )
00155 refcount = ++*mat->refcount;
00156 }
00157 else if( CV_IS_MATND( arr ))
00158 {
00159 CvMatND* mat = (CvMatND*)arr;
00160 if( mat->refcount != NULL )
00161 refcount = ++*mat->refcount;
00162 }
00163 return refcount;
00164 }
00165
00166
00167
00168 CVAPI(CvMat*) cvCloneMat( const CvMat* mat );
00169
00170
00171
00172
00173 CVAPI(CvMat*) cvGetSubRect( const CvArr* arr, CvMat* submat, CvRect rect );
00174 #define cvGetSubArr cvGetSubRect
00175
00176
00177
00178 CVAPI(CvMat*) cvGetRows( const CvArr* arr, CvMat* submat,
00179 int start_row, int end_row,
00180 int delta_row CV_DEFAULT(1));
00181
00182 CV_INLINE CvMat* cvGetRow( const CvArr* arr, CvMat* submat, int row )
00183 {
00184 return cvGetRows( arr, submat, row, row + 1, 1 );
00185 }
00186
00187
00188
00189
00190 CVAPI(CvMat*) cvGetCols( const CvArr* arr, CvMat* submat,
00191 int start_col, int end_col );
00192
00193 CV_INLINE CvMat* cvGetCol( const CvArr* arr, CvMat* submat, int col )
00194 {
00195 return cvGetCols( arr, submat, col, col + 1 );
00196 }
00197
00198
00199
00200
00201
00202 CVAPI(CvMat*) cvGetDiag( const CvArr* arr, CvMat* submat,
00203 int diag CV_DEFAULT(0));
00204
00205
00206 CVAPI(void) cvScalarToRawData( const CvScalar* scalar, void* data, int type,
00207 int extend_to_12 CV_DEFAULT(0) );
00208
00209 CVAPI(void) cvRawDataToScalar( const void* data, int type, CvScalar* scalar );
00210
00211
00212 CVAPI(CvMatND*) cvCreateMatNDHeader( int dims, const int* sizes, int type );
00213
00214
00215 CVAPI(CvMatND*) cvCreateMatND( int dims, const int* sizes, int type );
00216
00217
00218 CVAPI(CvMatND*) cvInitMatNDHeader( CvMatND* mat, int dims, const int* sizes,
00219 int type, void* data CV_DEFAULT(NULL) );
00220
00221
00222 CV_INLINE void cvReleaseMatND( CvMatND** mat )
00223 {
00224 cvReleaseMat( (CvMat**)mat );
00225 }
00226
00227
00228 CVAPI(CvMatND*) cvCloneMatND( const CvMatND* mat );
00229
00230
00231 CVAPI(CvSparseMat*) cvCreateSparseMat( int dims, const int* sizes, int type );
00232
00233
00234 CVAPI(void) cvReleaseSparseMat( CvSparseMat** mat );
00235
00236
00237 CVAPI(CvSparseMat*) cvCloneSparseMat( const CvSparseMat* mat );
00238
00239
00240
00241 CVAPI(CvSparseNode*) cvInitSparseMatIterator( const CvSparseMat* mat,
00242 CvSparseMatIterator* mat_iterator );
00243
00244
00245 CV_INLINE CvSparseNode* cvGetNextSparseNode( CvSparseMatIterator* mat_iterator )
00246 {
00247 if( mat_iterator->node->next )
00248 return mat_iterator->node = mat_iterator->node->next;
00249 else
00250 {
00251 int idx;
00252 for( idx = ++mat_iterator->curidx; idx < mat_iterator->mat->hashsize; idx++ )
00253 {
00254 CvSparseNode* node = (CvSparseNode*)mat_iterator->mat->hashtable[idx];
00255 if( node )
00256 {
00257 mat_iterator->curidx = idx;
00258 return mat_iterator->node = node;
00259 }
00260 }
00261 return NULL;
00262 }
00263 }
00264
00265
00266
00267 #define CV_MAX_ARR 10
00268
00269 typedef struct CvNArrayIterator
00270 {
00271 int count;
00272 int dims;
00273 CvSize size;
00274 uchar* ptr[CV_MAX_ARR];
00275 int stack[CV_MAX_DIM];
00276 CvMatND* hdr[CV_MAX_ARR];
00277
00278 }
00279 CvNArrayIterator;
00280
00281 #define CV_NO_DEPTH_CHECK 1
00282 #define CV_NO_CN_CHECK 2
00283 #define CV_NO_SIZE_CHECK 4
00284
00285
00286
00287
00288 CVAPI(int) cvInitNArrayIterator( int count, CvArr** arrs,
00289 const CvArr* mask, CvMatND* stubs,
00290 CvNArrayIterator* array_iterator,
00291 int flags CV_DEFAULT(0) );
00292
00293
00294 CVAPI(int) cvNextNArraySlice( CvNArrayIterator* array_iterator );
00295
00296
00297
00298
00299 CVAPI(int) cvGetElemType( const CvArr* arr );
00300
00301
00302
00303 CVAPI(int) cvGetDims( const CvArr* arr, int* sizes CV_DEFAULT(NULL) );
00304
00305
00306
00307
00308
00309 CVAPI(int) cvGetDimSize( const CvArr* arr, int index );
00310
00311
00312
00313
00314 CVAPI(uchar*) cvPtr1D( const CvArr* arr, int idx0, int* type CV_DEFAULT(NULL));
00315 CVAPI(uchar*) cvPtr2D( const CvArr* arr, int idx0, int idx1, int* type CV_DEFAULT(NULL) );
00316 CVAPI(uchar*) cvPtr3D( const CvArr* arr, int idx0, int idx1, int idx2,
00317 int* type CV_DEFAULT(NULL));
00318
00319
00320
00321
00322
00323 CVAPI(uchar*) cvPtrND( const CvArr* arr, const int* idx, int* type CV_DEFAULT(NULL),
00324 int create_node CV_DEFAULT(1),
00325 unsigned* precalc_hashval CV_DEFAULT(NULL));
00326
00327
00328 CVAPI(CvScalar) cvGet1D( const CvArr* arr, int idx0 );
00329 CVAPI(CvScalar) cvGet2D( const CvArr* arr, int idx0, int idx1 );
00330 CVAPI(CvScalar) cvGet3D( const CvArr* arr, int idx0, int idx1, int idx2 );
00331 CVAPI(CvScalar) cvGetND( const CvArr* arr, const int* idx );
00332
00333
00334 CVAPI(double) cvGetReal1D( const CvArr* arr, int idx0 );
00335 CVAPI(double) cvGetReal2D( const CvArr* arr, int idx0, int idx1 );
00336 CVAPI(double) cvGetReal3D( const CvArr* arr, int idx0, int idx1, int idx2 );
00337 CVAPI(double) cvGetRealND( const CvArr* arr, const int* idx );
00338
00339
00340 CVAPI(void) cvSet1D( CvArr* arr, int idx0, CvScalar value );
00341 CVAPI(void) cvSet2D( CvArr* arr, int idx0, int idx1, CvScalar value );
00342 CVAPI(void) cvSet3D( CvArr* arr, int idx0, int idx1, int idx2, CvScalar value );
00343 CVAPI(void) cvSetND( CvArr* arr, const int* idx, CvScalar value );
00344
00345
00346 CVAPI(void) cvSetReal1D( CvArr* arr, int idx0, double value );
00347 CVAPI(void) cvSetReal2D( CvArr* arr, int idx0, int idx1, double value );
00348 CVAPI(void) cvSetReal3D( CvArr* arr, int idx0,
00349 int idx1, int idx2, double value );
00350 CVAPI(void) cvSetRealND( CvArr* arr, const int* idx, double value );
00351
00352
00353
00354 CVAPI(void) cvClearND( CvArr* arr, const int* idx );
00355
00356
00357
00358
00359
00360
00361 CVAPI(CvMat*) cvGetMat( const CvArr* arr, CvMat* header,
00362 int* coi CV_DEFAULT(NULL),
00363 int allowND CV_DEFAULT(0));
00364
00365
00366 CVAPI(IplImage*) cvGetImage( const CvArr* arr, IplImage* image_header );
00367
00368
00369
00370
00371
00372
00373
00374
00375
00376
00377
00378
00379 CVAPI(CvArr*) cvReshapeMatND( const CvArr* arr,
00380 int sizeof_header, CvArr* header,
00381 int new_cn, int new_dims, int* new_sizes );
00382
00383 #define cvReshapeND( arr, header, new_cn, new_dims, new_sizes ) \
00384 cvReshapeMatND( (arr), sizeof(*(header)), (header), \
00385 (new_cn), (new_dims), (new_sizes))
00386
00387 CVAPI(CvMat*) cvReshape( const CvArr* arr, CvMat* header,
00388 int new_cn, int new_rows CV_DEFAULT(0) );
00389
00390
00391
00392 CVAPI(void) cvRepeat( const CvArr* src, CvArr* dst );
00393
00394
00395 CVAPI(void) cvCreateData( CvArr* arr );
00396
00397
00398 CVAPI(void) cvReleaseData( CvArr* arr );
00399
00400
00401
00402
00403 CVAPI(void) cvSetData( CvArr* arr, void* data, int step );
00404
00405
00406
00407
00408 CVAPI(void) cvGetRawData( const CvArr* arr, uchar** data,
00409 int* step CV_DEFAULT(NULL),
00410 CvSize* roi_size CV_DEFAULT(NULL));
00411
00412
00413 CVAPI(CvSize) cvGetSize( const CvArr* arr );
00414
00415
00416 CVAPI(void) cvCopy( const CvArr* src, CvArr* dst,
00417 const CvArr* mask CV_DEFAULT(NULL) );
00418
00419
00420
00421 CVAPI(void) cvSet( CvArr* arr, CvScalar value,
00422 const CvArr* mask CV_DEFAULT(NULL) );
00423
00424
00425 CVAPI(void) cvSetZero( CvArr* arr );
00426 #define cvZero cvSetZero
00427
00428
00429
00430
00431 CVAPI(void) cvSplit( const CvArr* src, CvArr* dst0, CvArr* dst1,
00432 CvArr* dst2, CvArr* dst3 );
00433
00434
00435
00436 CVAPI(void) cvMerge( const CvArr* src0, const CvArr* src1,
00437 const CvArr* src2, const CvArr* src3,
00438 CvArr* dst );
00439
00440
00441
00442 CVAPI(void) cvMixChannels( const CvArr** src, int src_count,
00443 CvArr** dst, int dst_count,
00444 const int* from_to, int pair_count );
00445
00446
00447
00448
00449
00450
00451 CVAPI(void) cvConvertScale( const CvArr* src, CvArr* dst,
00452 double scale CV_DEFAULT(1),
00453 double shift CV_DEFAULT(0) );
00454 #define cvCvtScale cvConvertScale
00455 #define cvScale cvConvertScale
00456 #define cvConvert( src, dst ) cvConvertScale( (src), (dst), 1, 0 )
00457
00458
00459
00460
00461
00462
00463
00464 CVAPI(void) cvConvertScaleAbs( const CvArr* src, CvArr* dst,
00465 double scale CV_DEFAULT(1),
00466 double shift CV_DEFAULT(0) );
00467 #define cvCvtScaleAbs cvConvertScaleAbs
00468
00469
00470
00471
00472
00473
00474 CVAPI(CvTermCriteria) cvCheckTermCriteria( CvTermCriteria criteria,
00475 double default_eps,
00476 int default_max_iters );
00477
00478
00479
00480
00481
00482
00483 CVAPI(void) cvAdd( const CvArr* src1, const CvArr* src2, CvArr* dst,
00484 const CvArr* mask CV_DEFAULT(NULL));
00485
00486
00487 CVAPI(void) cvAddS( const CvArr* src, CvScalar value, CvArr* dst,
00488 const CvArr* mask CV_DEFAULT(NULL));
00489
00490
00491 CVAPI(void) cvSub( const CvArr* src1, const CvArr* src2, CvArr* dst,
00492 const CvArr* mask CV_DEFAULT(NULL));
00493
00494
00495 CV_INLINE void cvSubS( const CvArr* src, CvScalar value, CvArr* dst,
00496 const CvArr* mask CV_DEFAULT(NULL))
00497 {
00498 cvAddS( src, cvScalar( -value.val[0], -value.val[1], -value.val[2], -value.val[3]),
00499 dst, mask );
00500 }
00501
00502
00503 CVAPI(void) cvSubRS( const CvArr* src, CvScalar value, CvArr* dst,
00504 const CvArr* mask CV_DEFAULT(NULL));
00505
00506
00507
00508 CVAPI(void) cvMul( const CvArr* src1, const CvArr* src2,
00509 CvArr* dst, double scale CV_DEFAULT(1) );
00510
00511
00512
00513
00514 CVAPI(void) cvDiv( const CvArr* src1, const CvArr* src2,
00515 CvArr* dst, double scale CV_DEFAULT(1));
00516
00517
00518 CVAPI(void) cvScaleAdd( const CvArr* src1, CvScalar scale,
00519 const CvArr* src2, CvArr* dst );
00520 #define cvAXPY( A, real_scalar, B, C ) cvScaleAdd(A, cvRealScalar(real_scalar), B, C)
00521
00522
00523 CVAPI(void) cvAddWeighted( const CvArr* src1, double alpha,
00524 const CvArr* src2, double beta,
00525 double gamma, CvArr* dst );
00526
00527
00528 CVAPI(double) cvDotProduct( const CvArr* src1, const CvArr* src2 );
00529
00530
00531 CVAPI(void) cvAnd( const CvArr* src1, const CvArr* src2,
00532 CvArr* dst, const CvArr* mask CV_DEFAULT(NULL));
00533
00534
00535 CVAPI(void) cvAndS( const CvArr* src, CvScalar value,
00536 CvArr* dst, const CvArr* mask CV_DEFAULT(NULL));
00537
00538
00539 CVAPI(void) cvOr( const CvArr* src1, const CvArr* src2,
00540 CvArr* dst, const CvArr* mask CV_DEFAULT(NULL));
00541
00542
00543 CVAPI(void) cvOrS( const CvArr* src, CvScalar value,
00544 CvArr* dst, const CvArr* mask CV_DEFAULT(NULL));
00545
00546
00547 CVAPI(void) cvXor( const CvArr* src1, const CvArr* src2,
00548 CvArr* dst, const CvArr* mask CV_DEFAULT(NULL));
00549
00550
00551 CVAPI(void) cvXorS( const CvArr* src, CvScalar value,
00552 CvArr* dst, const CvArr* mask CV_DEFAULT(NULL));
00553
00554
00555 CVAPI(void) cvNot( const CvArr* src, CvArr* dst );
00556
00557
00558 CVAPI(void) cvInRange( const CvArr* src, const CvArr* lower,
00559 const CvArr* upper, CvArr* dst );
00560
00561
00562 CVAPI(void) cvInRangeS( const CvArr* src, CvScalar lower,
00563 CvScalar upper, CvArr* dst );
00564
00565 #define CV_CMP_EQ 0
00566 #define CV_CMP_GT 1
00567 #define CV_CMP_GE 2
00568 #define CV_CMP_LT 3
00569 #define CV_CMP_LE 4
00570 #define CV_CMP_NE 5
00571
00572
00573
00574
00575
00576 CVAPI(void) cvCmp( const CvArr* src1, const CvArr* src2, CvArr* dst, int cmp_op );
00577
00578
00579 CVAPI(void) cvCmpS( const CvArr* src, double value, CvArr* dst, int cmp_op );
00580
00581
00582 CVAPI(void) cvMin( const CvArr* src1, const CvArr* src2, CvArr* dst );
00583
00584
00585 CVAPI(void) cvMax( const CvArr* src1, const CvArr* src2, CvArr* dst );
00586
00587
00588 CVAPI(void) cvMinS( const CvArr* src, double value, CvArr* dst );
00589
00590
00591 CVAPI(void) cvMaxS( const CvArr* src, double value, CvArr* dst );
00592
00593
00594 CVAPI(void) cvAbsDiff( const CvArr* src1, const CvArr* src2, CvArr* dst );
00595
00596
00597 CVAPI(void) cvAbsDiffS( const CvArr* src, CvArr* dst, CvScalar value );
00598 #define cvAbs( src, dst ) cvAbsDiffS( (src), (dst), cvScalarAll(0))
00599
00600
00601
00602
00603
00604
00605
00606 CVAPI(void) cvCartToPolar( const CvArr* x, const CvArr* y,
00607 CvArr* magnitude, CvArr* angle CV_DEFAULT(NULL),
00608 int angle_in_degrees CV_DEFAULT(0));
00609
00610
00611
00612
00613 CVAPI(void) cvPolarToCart( const CvArr* magnitude, const CvArr* angle,
00614 CvArr* x, CvArr* y,
00615 int angle_in_degrees CV_DEFAULT(0));
00616
00617
00618 CVAPI(void) cvPow( const CvArr* src, CvArr* dst, double power );
00619
00620
00621
00622
00623 CVAPI(void) cvExp( const CvArr* src, CvArr* dst );
00624
00625
00626
00627
00628
00629 CVAPI(void) cvLog( const CvArr* src, CvArr* dst );
00630
00631
00632 CVAPI(float) cvFastArctan( float y, float x );
00633
00634
00635 CVAPI(float) cvCbrt( float value );
00636
00637
00638
00639
00640
00641 #define CV_CHECK_RANGE 1
00642 #define CV_CHECK_QUIET 2
00643 CVAPI(int) cvCheckArr( const CvArr* arr, int flags CV_DEFAULT(0),
00644 double min_val CV_DEFAULT(0), double max_val CV_DEFAULT(0));
00645 #define cvCheckArray cvCheckArr
00646
00647 #define CV_RAND_UNI 0
00648 #define CV_RAND_NORMAL 1
00649 CVAPI(void) cvRandArr( CvRNG* rng, CvArr* arr, int dist_type,
00650 CvScalar param1, CvScalar param2 );
00651
00652 CVAPI(void) cvRandShuffle( CvArr* mat, CvRNG* rng,
00653 double iter_factor CV_DEFAULT(1.));
00654
00655 #define CV_SORT_EVERY_ROW 0
00656 #define CV_SORT_EVERY_COLUMN 1
00657 #define CV_SORT_ASCENDING 0
00658 #define CV_SORT_DESCENDING 16
00659
00660 CVAPI(void) cvSort( const CvArr* src, CvArr* dst CV_DEFAULT(NULL),
00661 CvArr* idxmat CV_DEFAULT(NULL),
00662 int flags CV_DEFAULT(0));
00663
00664
00665 CVAPI(int) cvSolveCubic( const CvMat* coeffs, CvMat* roots );
00666
00667
00668 CVAPI(void) cvSolvePoly(const CvMat* coeffs, CvMat *roots2,
00669 int maxiter CV_DEFAULT(20), int fig CV_DEFAULT(100));
00670
00671
00672
00673
00674
00675
00676 CVAPI(void) cvCrossProduct( const CvArr* src1, const CvArr* src2, CvArr* dst );
00677
00678
00679 #define cvMatMulAdd( src1, src2, src3, dst ) cvGEMM( (src1), (src2), 1., (src3), 1., (dst), 0 )
00680 #define cvMatMul( src1, src2, dst ) cvMatMulAdd( (src1), (src2), NULL, (dst))
00681
00682 #define CV_GEMM_A_T 1
00683 #define CV_GEMM_B_T 2
00684 #define CV_GEMM_C_T 4
00685
00686
00687 CVAPI(void) cvGEMM( const CvArr* src1, const CvArr* src2, double alpha,
00688 const CvArr* src3, double beta, CvArr* dst,
00689 int tABC CV_DEFAULT(0));
00690 #define cvMatMulAddEx cvGEMM
00691
00692
00693
00694 CVAPI(void) cvTransform( const CvArr* src, CvArr* dst,
00695 const CvMat* transmat,
00696 const CvMat* shiftvec CV_DEFAULT(NULL));
00697 #define cvMatMulAddS cvTransform
00698
00699
00700 CVAPI(void) cvPerspectiveTransform( const CvArr* src, CvArr* dst,
00701 const CvMat* mat );
00702
00703
00704 CVAPI(void) cvMulTransposed( const CvArr* src, CvArr* dst, int order,
00705 const CvArr* delta CV_DEFAULT(NULL),
00706 double scale CV_DEFAULT(1.) );
00707
00708
00709 CVAPI(void) cvTranspose( const CvArr* src, CvArr* dst );
00710 #define cvT cvTranspose
00711
00712
00713 CVAPI(void) cvCompleteSymm( CvMat* matrix, int LtoR CV_DEFAULT(0) );
00714
00715
00716
00717
00718 CVAPI(void) cvFlip( const CvArr* src, CvArr* dst CV_DEFAULT(NULL),
00719 int flip_mode CV_DEFAULT(0));
00720 #define cvMirror cvFlip
00721
00722
00723 #define CV_SVD_MODIFY_A 1
00724 #define CV_SVD_U_T 2
00725 #define CV_SVD_V_T 4
00726
00727
00728 CVAPI(void) cvSVD( CvArr* A, CvArr* W, CvArr* U CV_DEFAULT(NULL),
00729 CvArr* V CV_DEFAULT(NULL), int flags CV_DEFAULT(0));
00730
00731
00732
00733 CVAPI(void) cvSVBkSb( const CvArr* W, const CvArr* U,
00734 const CvArr* V, const CvArr* B,
00735 CvArr* X, int flags );
00736
00737 #define CV_LU 0
00738 #define CV_SVD 1
00739 #define CV_SVD_SYM 2
00740 #define CV_CHOLESKY 3
00741 #define CV_QR 4
00742 #define CV_NORMAL 16
00743
00744
00745 CVAPI(double) cvInvert( const CvArr* src, CvArr* dst,
00746 int method CV_DEFAULT(CV_LU));
00747 #define cvInv cvInvert
00748
00749
00750
00751 CVAPI(int) cvSolve( const CvArr* src1, const CvArr* src2, CvArr* dst,
00752 int method CV_DEFAULT(CV_LU));
00753
00754
00755 CVAPI(double) cvDet( const CvArr* mat );
00756
00757
00758 CVAPI(CvScalar) cvTrace( const CvArr* mat );
00759
00760
00761 CVAPI(void) cvEigenVV( CvArr* mat, CvArr* evects, CvArr* evals,
00762 double eps CV_DEFAULT(0),
00763 int lowindex CV_DEFAULT(-1),
00764 int highindex CV_DEFAULT(-1));
00765
00767
00768
00769
00770
00771 CVAPI(void) cvSetIdentity( CvArr* mat, CvScalar value CV_DEFAULT(cvRealScalar(1)) );
00772
00773
00774 CVAPI(CvArr*) cvRange( CvArr* mat, double start, double end );
00775
00776
00777
00778 #define CV_COVAR_SCRAMBLED 0
00779
00780
00781 #define CV_COVAR_NORMAL 1
00782
00783
00784
00785 #define CV_COVAR_USE_AVG 2
00786
00787
00788 #define CV_COVAR_SCALE 4
00789
00790
00791 #define CV_COVAR_ROWS 8
00792
00793
00794 #define CV_COVAR_COLS 16
00795
00796 CVAPI(void) cvCalcCovarMatrix( const CvArr** vects, int count,
00797 CvArr* cov_mat, CvArr* avg, int flags );
00798
00799 #define CV_PCA_DATA_AS_ROW 0
00800 #define CV_PCA_DATA_AS_COL 1
00801 #define CV_PCA_USE_AVG 2
00802 CVAPI(void) cvCalcPCA( const CvArr* data, CvArr* mean,
00803 CvArr* eigenvals, CvArr* eigenvects, int flags );
00804
00805 CVAPI(void) cvProjectPCA( const CvArr* data, const CvArr* mean,
00806 const CvArr* eigenvects, CvArr* result );
00807
00808 CVAPI(void) cvBackProjectPCA( const CvArr* proj, const CvArr* mean,
00809 const CvArr* eigenvects, CvArr* result );
00810
00811
00812 CVAPI(double) cvMahalanobis( const CvArr* vec1, const CvArr* vec2, const CvArr* mat );
00813 #define cvMahalonobis cvMahalanobis
00814
00815
00816
00817
00818
00819
00820 CVAPI(CvScalar) cvSum( const CvArr* arr );
00821
00822
00823 CVAPI(int) cvCountNonZero( const CvArr* arr );
00824
00825
00826 CVAPI(CvScalar) cvAvg( const CvArr* arr, const CvArr* mask CV_DEFAULT(NULL) );
00827
00828
00829 CVAPI(void) cvAvgSdv( const CvArr* arr, CvScalar* mean, CvScalar* std_dev,
00830 const CvArr* mask CV_DEFAULT(NULL) );
00831
00832
00833 CVAPI(void) cvMinMaxLoc( const CvArr* arr, double* min_val, double* max_val,
00834 CvPoint* min_loc CV_DEFAULT(NULL),
00835 CvPoint* max_loc CV_DEFAULT(NULL),
00836 const CvArr* mask CV_DEFAULT(NULL) );
00837
00838
00839 #define CV_C 1
00840 #define CV_L1 2
00841 #define CV_L2 4
00842 #define CV_NORM_MASK 7
00843 #define CV_RELATIVE 8
00844 #define CV_DIFF 16
00845 #define CV_MINMAX 32
00846
00847 #define CV_DIFF_C (CV_DIFF | CV_C)
00848 #define CV_DIFF_L1 (CV_DIFF | CV_L1)
00849 #define CV_DIFF_L2 (CV_DIFF | CV_L2)
00850 #define CV_RELATIVE_C (CV_RELATIVE | CV_C)
00851 #define CV_RELATIVE_L1 (CV_RELATIVE | CV_L1)
00852 #define CV_RELATIVE_L2 (CV_RELATIVE | CV_L2)
00853
00854
00855 CVAPI(double) cvNorm( const CvArr* arr1, const CvArr* arr2 CV_DEFAULT(NULL),
00856 int norm_type CV_DEFAULT(CV_L2),
00857 const CvArr* mask CV_DEFAULT(NULL) );
00858
00859 CVAPI(void) cvNormalize( const CvArr* src, CvArr* dst,
00860 double a CV_DEFAULT(1.), double b CV_DEFAULT(0.),
00861 int norm_type CV_DEFAULT(CV_L2),
00862 const CvArr* mask CV_DEFAULT(NULL) );
00863
00864
00865 #define CV_REDUCE_SUM 0
00866 #define CV_REDUCE_AVG 1
00867 #define CV_REDUCE_MAX 2
00868 #define CV_REDUCE_MIN 3
00869
00870 CVAPI(void) cvReduce( const CvArr* src, CvArr* dst, int dim CV_DEFAULT(-1),
00871 int op CV_DEFAULT(CV_REDUCE_SUM) );
00872
00873
00874
00875
00876
00877 #define CV_DXT_FORWARD 0
00878 #define CV_DXT_INVERSE 1
00879 #define CV_DXT_SCALE 2
00880 #define CV_DXT_INV_SCALE (CV_DXT_INVERSE + CV_DXT_SCALE)
00881 #define CV_DXT_INVERSE_SCALE CV_DXT_INV_SCALE
00882 #define CV_DXT_ROWS 4
00883 #define CV_DXT_MUL_CONJ 8
00884
00885
00886
00887
00888
00889 CVAPI(void) cvDFT( const CvArr* src, CvArr* dst, int flags,
00890 int nonzero_rows CV_DEFAULT(0) );
00891 #define cvFFT cvDFT
00892
00893
00894 CVAPI(void) cvMulSpectrums( const CvArr* src1, const CvArr* src2,
00895 CvArr* dst, int flags );
00896
00897
00898 CVAPI(int) cvGetOptimalDFTSize( int size0 );
00899
00900
00901 CVAPI(void) cvDCT( const CvArr* src, CvArr* dst, int flags );
00902
00903
00904
00905
00906
00907
00908 CVAPI(int) cvSliceLength( CvSlice slice, const CvSeq* seq );
00909
00910
00911
00912
00913
00914 CVAPI(CvMemStorage*) cvCreateMemStorage( int block_size CV_DEFAULT(0));
00915
00916
00917
00918 CVAPI(CvMemStorage*) cvCreateChildMemStorage( CvMemStorage* parent );
00919
00920
00921
00922
00923 CVAPI(void) cvReleaseMemStorage( CvMemStorage** storage );
00924
00925
00926
00927
00928
00929
00930 CVAPI(void) cvClearMemStorage( CvMemStorage* storage );
00931
00932
00933 CVAPI(void) cvSaveMemStoragePos( const CvMemStorage* storage, CvMemStoragePos* pos );
00934
00935
00936 CVAPI(void) cvRestoreMemStoragePos( CvMemStorage* storage, CvMemStoragePos* pos );
00937
00938
00939 CVAPI(void*) cvMemStorageAlloc( CvMemStorage* storage, size_t size );
00940
00941
00942 CVAPI(CvString) cvMemStorageAllocString( CvMemStorage* storage, const char* ptr,
00943 int len CV_DEFAULT(-1) );
00944
00945
00946 CVAPI(CvSeq*) cvCreateSeq( int seq_flags, int header_size,
00947 int elem_size, CvMemStorage* storage );
00948
00949
00950
00951 CVAPI(void) cvSetSeqBlockSize( CvSeq* seq, int delta_elems );
00952
00953
00954
00955 CVAPI(schar*) cvSeqPush( CvSeq* seq, const void* element CV_DEFAULT(NULL));
00956
00957
00958
00959 CVAPI(schar*) cvSeqPushFront( CvSeq* seq, const void* element CV_DEFAULT(NULL));
00960
00961
00962
00963 CVAPI(void) cvSeqPop( CvSeq* seq, void* element CV_DEFAULT(NULL));
00964
00965
00966
00967 CVAPI(void) cvSeqPopFront( CvSeq* seq, void* element CV_DEFAULT(NULL));
00968
00969
00970 #define CV_FRONT 1
00971 #define CV_BACK 0
00972
00973 CVAPI(void) cvSeqPushMulti( CvSeq* seq, const void* elements,
00974 int count, int in_front CV_DEFAULT(0) );
00975
00976
00977 CVAPI(void) cvSeqPopMulti( CvSeq* seq, void* elements,
00978 int count, int in_front CV_DEFAULT(0) );
00979
00980
00981
00982 CVAPI(schar*) cvSeqInsert( CvSeq* seq, int before_index,
00983 const void* element CV_DEFAULT(NULL));
00984
00985
00986 CVAPI(void) cvSeqRemove( CvSeq* seq, int index );
00987
00988
00989
00990
00991
00992 CVAPI(void) cvClearSeq( CvSeq* seq );
00993
00994
00995
00996
00997
00998 CVAPI(schar*) cvGetSeqElem( const CvSeq* seq, int index );
00999
01000
01001
01002 CVAPI(int) cvSeqElemIdx( const CvSeq* seq, const void* element,
01003 CvSeqBlock** block CV_DEFAULT(NULL) );
01004
01005
01006 CVAPI(void) cvStartAppendToSeq( CvSeq* seq, CvSeqWriter* writer );
01007
01008
01009
01010 CVAPI(void) cvStartWriteSeq( int seq_flags, int header_size,
01011 int elem_size, CvMemStorage* storage,
01012 CvSeqWriter* writer );
01013
01014
01015
01016
01017
01018 CVAPI(CvSeq*) cvEndWriteSeq( CvSeqWriter* writer );
01019
01020
01021
01022
01023 CVAPI(void) cvFlushSeqWriter( CvSeqWriter* writer );
01024
01025
01026
01027
01028 CVAPI(void) cvStartReadSeq( const CvSeq* seq, CvSeqReader* reader,
01029 int reverse CV_DEFAULT(0) );
01030
01031
01032
01033 CVAPI(int) cvGetSeqReaderPos( CvSeqReader* reader );
01034
01035
01036
01037
01038 CVAPI(void) cvSetSeqReaderPos( CvSeqReader* reader, int index,
01039 int is_relative CV_DEFAULT(0));
01040
01041
01042 CVAPI(void*) cvCvtSeqToArray( const CvSeq* seq, void* elements,
01043 CvSlice slice CV_DEFAULT(CV_WHOLE_SEQ) );
01044
01045
01046
01047
01048 CVAPI(CvSeq*) cvMakeSeqHeaderForArray( int seq_type, int header_size,
01049 int elem_size, void* elements, int total,
01050 CvSeq* seq, CvSeqBlock* block );
01051
01052
01053 CVAPI(CvSeq*) cvSeqSlice( const CvSeq* seq, CvSlice slice,
01054 CvMemStorage* storage CV_DEFAULT(NULL),
01055 int copy_data CV_DEFAULT(0));
01056
01057 CV_INLINE CvSeq* cvCloneSeq( const CvSeq* seq, CvMemStorage* storage CV_DEFAULT(NULL))
01058 {
01059 return cvSeqSlice( seq, CV_WHOLE_SEQ, storage, 1 );
01060 }
01061
01062
01063 CVAPI(void) cvSeqRemoveSlice( CvSeq* seq, CvSlice slice );
01064
01065
01066 CVAPI(void) cvSeqInsertSlice( CvSeq* seq, int before_index, const CvArr* from_arr );
01067
01068
01069 typedef int (CV_CDECL* CvCmpFunc)(const void* a, const void* b, void* userdata );
01070
01071
01072 CVAPI(void) cvSeqSort( CvSeq* seq, CvCmpFunc func, void* userdata CV_DEFAULT(NULL) );
01073
01074
01075 CVAPI(schar*) cvSeqSearch( CvSeq* seq, const void* elem, CvCmpFunc func,
01076 int is_sorted, int* elem_idx,
01077 void* userdata CV_DEFAULT(NULL) );
01078
01079
01080 CVAPI(void) cvSeqInvert( CvSeq* seq );
01081
01082
01083 CVAPI(int) cvSeqPartition( const CvSeq* seq, CvMemStorage* storage,
01084 CvSeq** labels, CvCmpFunc is_equal, void* userdata );
01085
01086
01087 CVAPI(void) cvChangeSeqBlock( void* reader, int direction );
01088 CVAPI(void) cvCreateSeqBlock( CvSeqWriter* writer );
01089
01090
01091
01092 CVAPI(CvSet*) cvCreateSet( int set_flags, int header_size,
01093 int elem_size, CvMemStorage* storage );
01094
01095
01096 CVAPI(int) cvSetAdd( CvSet* set_header, CvSetElem* elem CV_DEFAULT(NULL),
01097 CvSetElem** inserted_elem CV_DEFAULT(NULL) );
01098
01099
01100 CV_INLINE CvSetElem* cvSetNew( CvSet* set_header )
01101 {
01102 CvSetElem* elem = set_header->free_elems;
01103 if( elem )
01104 {
01105 set_header->free_elems = elem->next_free;
01106 elem->flags = elem->flags & CV_SET_ELEM_IDX_MASK;
01107 set_header->active_count++;
01108 }
01109 else
01110 cvSetAdd( set_header, NULL, (CvSetElem**)&elem );
01111 return elem;
01112 }
01113
01114
01115 CV_INLINE void cvSetRemoveByPtr( CvSet* set_header, void* elem )
01116 {
01117 CvSetElem* _elem = (CvSetElem*)elem;
01118 assert( _elem->flags >= 0 );
01119 _elem->next_free = set_header->free_elems;
01120 _elem->flags = (_elem->flags & CV_SET_ELEM_IDX_MASK) | CV_SET_ELEM_FREE_FLAG;
01121 set_header->free_elems = _elem;
01122 set_header->active_count--;
01123 }
01124
01125
01126 CVAPI(void) cvSetRemove( CvSet* set_header, int index );
01127
01128
01129
01130 CV_INLINE CvSetElem* cvGetSetElem( const CvSet* set_header, int index )
01131 {
01132 CvSetElem* elem = (CvSetElem*)cvGetSeqElem( (CvSeq*)set_header, index );
01133 return elem && CV_IS_SET_ELEM( elem ) ? elem : 0;
01134 }
01135
01136
01137 CVAPI(void) cvClearSet( CvSet* set_header );
01138
01139
01140 CVAPI(CvGraph*) cvCreateGraph( int graph_flags, int header_size,
01141 int vtx_size, int edge_size,
01142 CvMemStorage* storage );
01143
01144
01145 CVAPI(int) cvGraphAddVtx( CvGraph* graph, const CvGraphVtx* vtx CV_DEFAULT(NULL),
01146 CvGraphVtx** inserted_vtx CV_DEFAULT(NULL) );
01147
01148
01149
01150 CVAPI(int) cvGraphRemoveVtx( CvGraph* graph, int index );
01151 CVAPI(int) cvGraphRemoveVtxByPtr( CvGraph* graph, CvGraphVtx* vtx );
01152
01153
01154
01155
01156
01157
01158 CVAPI(int) cvGraphAddEdge( CvGraph* graph,
01159 int start_idx, int end_idx,
01160 const CvGraphEdge* edge CV_DEFAULT(NULL),
01161 CvGraphEdge** inserted_edge CV_DEFAULT(NULL) );
01162
01163 CVAPI(int) cvGraphAddEdgeByPtr( CvGraph* graph,
01164 CvGraphVtx* start_vtx, CvGraphVtx* end_vtx,
01165 const CvGraphEdge* edge CV_DEFAULT(NULL),
01166 CvGraphEdge** inserted_edge CV_DEFAULT(NULL) );
01167
01168
01169 CVAPI(void) cvGraphRemoveEdge( CvGraph* graph, int start_idx, int end_idx );
01170 CVAPI(void) cvGraphRemoveEdgeByPtr( CvGraph* graph, CvGraphVtx* start_vtx,
01171 CvGraphVtx* end_vtx );
01172
01173
01174 CVAPI(CvGraphEdge*) cvFindGraphEdge( const CvGraph* graph, int start_idx, int end_idx );
01175 CVAPI(CvGraphEdge*) cvFindGraphEdgeByPtr( const CvGraph* graph,
01176 const CvGraphVtx* start_vtx,
01177 const CvGraphVtx* end_vtx );
01178 #define cvGraphFindEdge cvFindGraphEdge
01179 #define cvGraphFindEdgeByPtr cvFindGraphEdgeByPtr
01180
01181
01182 CVAPI(void) cvClearGraph( CvGraph* graph );
01183
01184
01185
01186 CVAPI(int) cvGraphVtxDegree( const CvGraph* graph, int vtx_idx );
01187 CVAPI(int) cvGraphVtxDegreeByPtr( const CvGraph* graph, const CvGraphVtx* vtx );
01188
01189
01190
01191 #define cvGetGraphVtx( graph, idx ) (CvGraphVtx*)cvGetSetElem((CvSet*)(graph), (idx))
01192
01193
01194 #define cvGraphVtxIdx( graph, vtx ) ((vtx)->flags & CV_SET_ELEM_IDX_MASK)
01195
01196
01197 #define cvGraphEdgeIdx( graph, edge ) ((edge)->flags & CV_SET_ELEM_IDX_MASK)
01198
01199 #define cvGraphGetVtxCount( graph ) ((graph)->active_count)
01200 #define cvGraphGetEdgeCount( graph ) ((graph)->edges->active_count)
01201
01202 #define CV_GRAPH_VERTEX 1
01203 #define CV_GRAPH_TREE_EDGE 2
01204 #define CV_GRAPH_BACK_EDGE 4
01205 #define CV_GRAPH_FORWARD_EDGE 8
01206 #define CV_GRAPH_CROSS_EDGE 16
01207 #define CV_GRAPH_ANY_EDGE 30
01208 #define CV_GRAPH_NEW_TREE 32
01209 #define CV_GRAPH_BACKTRACKING 64
01210 #define CV_GRAPH_OVER -1
01211
01212 #define CV_GRAPH_ALL_ITEMS -1
01213
01214
01215 #define CV_GRAPH_ITEM_VISITED_FLAG (1 << 30)
01216 #define CV_IS_GRAPH_VERTEX_VISITED(vtx) \
01217 (((CvGraphVtx*)(vtx))->flags & CV_GRAPH_ITEM_VISITED_FLAG)
01218 #define CV_IS_GRAPH_EDGE_VISITED(edge) \
01219 (((CvGraphEdge*)(edge))->flags & CV_GRAPH_ITEM_VISITED_FLAG)
01220 #define CV_GRAPH_SEARCH_TREE_NODE_FLAG (1 << 29)
01221 #define CV_GRAPH_FORWARD_EDGE_FLAG (1 << 28)
01222
01223 typedef struct CvGraphScanner
01224 {
01225 CvGraphVtx* vtx;
01226 CvGraphVtx* dst;
01227 CvGraphEdge* edge;
01228
01229 CvGraph* graph;
01230 CvSeq* stack;
01231 int index;
01232 int mask;
01233 }
01234 CvGraphScanner;
01235
01236
01237 CVAPI(CvGraphScanner*) cvCreateGraphScanner( CvGraph* graph,
01238 CvGraphVtx* vtx CV_DEFAULT(NULL),
01239 int mask CV_DEFAULT(CV_GRAPH_ALL_ITEMS));
01240
01241
01242 CVAPI(void) cvReleaseGraphScanner( CvGraphScanner** scanner );
01243
01244
01245 CVAPI(int) cvNextGraphItem( CvGraphScanner* scanner );
01246
01247
01248 CVAPI(CvGraph*) cvCloneGraph( const CvGraph* graph, CvMemStorage* storage );
01249
01250
01251
01252
01253
01254
01255
01256
01257
01258
01259
01260
01261
01262
01263
01264 #define CV_RGB( r, g, b ) cvScalar( (b), (g), (r), 0 )
01265 #define CV_FILLED -1
01266
01267 #define CV_AA 16
01268
01269
01270 CVAPI(void) cvLine( CvArr* img, CvPoint pt1, CvPoint pt2,
01271 CvScalar color, int thickness CV_DEFAULT(1),
01272 int line_type CV_DEFAULT(8), int shift CV_DEFAULT(0) );
01273
01274
01275
01276 CVAPI(void) cvRectangle( CvArr* img, CvPoint pt1, CvPoint pt2,
01277 CvScalar color, int thickness CV_DEFAULT(1),
01278 int line_type CV_DEFAULT(8),
01279 int shift CV_DEFAULT(0));
01280
01281
01282 CVAPI(void) cvRectangleR( CvArr* img, CvRect r,
01283 CvScalar color, int thickness CV_DEFAULT(1),
01284 int line_type CV_DEFAULT(8),
01285 int shift CV_DEFAULT(0));
01286
01287
01288
01289
01290 CVAPI(void) cvCircle( CvArr* img, CvPoint center, int radius,
01291 CvScalar color, int thickness CV_DEFAULT(1),
01292 int line_type CV_DEFAULT(8), int shift CV_DEFAULT(0));
01293
01294
01295
01296
01297 CVAPI(void) cvEllipse( CvArr* img, CvPoint center, CvSize axes,
01298 double angle, double start_angle, double end_angle,
01299 CvScalar color, int thickness CV_DEFAULT(1),
01300 int line_type CV_DEFAULT(8), int shift CV_DEFAULT(0));
01301
01302 CV_INLINE void cvEllipseBox( CvArr* img, CvBox2D box, CvScalar color,
01303 int thickness CV_DEFAULT(1),
01304 int line_type CV_DEFAULT(8), int shift CV_DEFAULT(0) )
01305 {
01306 CvSize axes;
01307 axes.width = cvRound(box.size.width*0.5);
01308 axes.height = cvRound(box.size.height*0.5);
01309
01310 cvEllipse( img, cvPointFrom32f( box.center ), axes, box.angle,
01311 0, 360, color, thickness, line_type, shift );
01312 }
01313
01314
01315 CVAPI(void) cvFillConvexPoly( CvArr* img, const CvPoint* pts, int npts, CvScalar color,
01316 int line_type CV_DEFAULT(8), int shift CV_DEFAULT(0));
01317
01318
01319 CVAPI(void) cvFillPoly( CvArr* img, CvPoint** pts, const int* npts,
01320 int contours, CvScalar color,
01321 int line_type CV_DEFAULT(8), int shift CV_DEFAULT(0) );
01322
01323
01324 CVAPI(void) cvPolyLine( CvArr* img, CvPoint** pts, const int* npts, int contours,
01325 int is_closed, CvScalar color, int thickness CV_DEFAULT(1),
01326 int line_type CV_DEFAULT(8), int shift CV_DEFAULT(0) );
01327
01328 #define cvDrawRect cvRectangle
01329 #define cvDrawLine cvLine
01330 #define cvDrawCircle cvCircle
01331 #define cvDrawEllipse cvEllipse
01332 #define cvDrawPolyLine cvPolyLine
01333
01334
01335
01336
01337 CVAPI(int) cvClipLine( CvSize img_size, CvPoint* pt1, CvPoint* pt2 );
01338
01339
01340
01341
01342 CVAPI(int) cvInitLineIterator( const CvArr* image, CvPoint pt1, CvPoint pt2,
01343 CvLineIterator* line_iterator,
01344 int connectivity CV_DEFAULT(8),
01345 int left_to_right CV_DEFAULT(0));
01346
01347
01348 #define CV_NEXT_LINE_POINT( line_iterator ) \
01349 { \
01350 int _line_iterator_mask = (line_iterator).err < 0 ? -1 : 0; \
01351 (line_iterator).err += (line_iterator).minus_delta + \
01352 ((line_iterator).plus_delta & _line_iterator_mask); \
01353 (line_iterator).ptr += (line_iterator).minus_step + \
01354 ((line_iterator).plus_step & _line_iterator_mask); \
01355 }
01356
01357
01358
01359 #define CV_FONT_HERSHEY_SIMPLEX 0
01360 #define CV_FONT_HERSHEY_PLAIN 1
01361 #define CV_FONT_HERSHEY_DUPLEX 2
01362 #define CV_FONT_HERSHEY_COMPLEX 3
01363 #define CV_FONT_HERSHEY_TRIPLEX 4
01364 #define CV_FONT_HERSHEY_COMPLEX_SMALL 5
01365 #define CV_FONT_HERSHEY_SCRIPT_SIMPLEX 6
01366 #define CV_FONT_HERSHEY_SCRIPT_COMPLEX 7
01367
01368
01369 #define CV_FONT_ITALIC 16
01370
01371 #define CV_FONT_VECTOR0 CV_FONT_HERSHEY_SIMPLEX
01372
01373
01374
01375 typedef struct CvFont
01376 {
01377 const char* nameFont;
01378 CvScalar color;
01379 int font_face;
01380 const int* ascii;
01381 const int* greek;
01382 const int* cyrillic;
01383 float hscale, vscale;
01384 float shear;
01385 int thickness;
01386 float dx;
01387 int line_type;
01388 }
01389 CvFont;
01390
01391
01392 CVAPI(void) cvInitFont( CvFont* font, int font_face,
01393 double hscale, double vscale,
01394 double shear CV_DEFAULT(0),
01395 int thickness CV_DEFAULT(1),
01396 int line_type CV_DEFAULT(8));
01397
01398 CV_INLINE CvFont cvFont( double scale, int thickness CV_DEFAULT(1) )
01399 {
01400 CvFont font;
01401 cvInitFont( &font, CV_FONT_HERSHEY_PLAIN, scale, scale, 0, thickness, CV_AA );
01402 return font;
01403 }
01404
01405
01406
01407 CVAPI(void) cvPutText( CvArr* img, const char* text, CvPoint org,
01408 const CvFont* font, CvScalar color );
01409
01410
01411 CVAPI(void) cvGetTextSize( const char* text_string, const CvFont* font,
01412 CvSize* text_size, int* baseline );
01413
01414
01415
01416
01417
01418
01419 CVAPI(CvScalar) cvColorToScalar( double packed_color, int arrtype );
01420
01421
01422
01423
01424
01425
01426
01427 CVAPI(int) cvEllipse2Poly( CvPoint center, CvSize axes,
01428 int angle, int arc_start, int arc_end, CvPoint * pts, int delta );
01429
01430
01431 CVAPI(void) cvDrawContours( CvArr *img, CvSeq* contour,
01432 CvScalar external_color, CvScalar hole_color,
01433 int max_level, int thickness CV_DEFAULT(1),
01434 int line_type CV_DEFAULT(8),
01435 CvPoint offset CV_DEFAULT(cvPoint(0,0)));
01436
01437
01438
01439 CVAPI(void) cvLUT( const CvArr* src, CvArr* dst, const CvArr* lut );
01440
01441
01442
01443 typedef struct CvTreeNodeIterator
01444 {
01445 const void* node;
01446 int level;
01447 int max_level;
01448 }
01449 CvTreeNodeIterator;
01450
01451 CVAPI(void) cvInitTreeNodeIterator( CvTreeNodeIterator* tree_iterator,
01452 const void* first, int max_level );
01453 CVAPI(void*) cvNextTreeNode( CvTreeNodeIterator* tree_iterator );
01454 CVAPI(void*) cvPrevTreeNode( CvTreeNodeIterator* tree_iterator );
01455
01456
01457
01458
01459 CVAPI(void) cvInsertNodeIntoTree( void* node, void* parent, void* frame );
01460
01461
01462 CVAPI(void) cvRemoveNodeFromTree( void* node, void* frame );
01463
01464
01465
01466 CVAPI(CvSeq*) cvTreeToNodeSeq( const void* first, int header_size,
01467 CvMemStorage* storage );
01468
01469
01470
01471 #define CV_KMEANS_USE_INITIAL_LABELS 1
01472 CVAPI(int) cvKMeans2( const CvArr* samples, int cluster_count, CvArr* labels,
01473 CvTermCriteria termcrit, int attempts CV_DEFAULT(1),
01474 CvRNG* rng CV_DEFAULT(0), int flags CV_DEFAULT(0),
01475 CvArr* _centers CV_DEFAULT(0), double* compactness CV_DEFAULT(0) );
01476
01477
01478
01479
01480
01481
01482 CVAPI(int) cvRegisterModule( const CvModuleInfo* module_info );
01483
01484
01485 CVAPI(int) cvUseOptimized( int on_off );
01486
01487
01488 CVAPI(void) cvGetModuleInfo( const char* module_name,
01489 const char** version,
01490 const char** loaded_addon_plugins );
01491
01492 typedef void* (CV_CDECL *CvAllocFunc)(size_t size, void* userdata);
01493 typedef int (CV_CDECL *CvFreeFunc)(void* pptr, void* userdata);
01494
01495
01496
01497 CVAPI(void) cvSetMemoryManager( CvAllocFunc alloc_func CV_DEFAULT(NULL),
01498 CvFreeFunc free_func CV_DEFAULT(NULL),
01499 void* userdata CV_DEFAULT(NULL));
01500
01501
01502 typedef IplImage* (CV_STDCALL* Cv_iplCreateImageHeader)
01503 (int,int,int,char*,char*,int,int,int,int,int,
01504 IplROI*,IplImage*,void*,IplTileInfo*);
01505 typedef void (CV_STDCALL* Cv_iplAllocateImageData)(IplImage*,int,int);
01506 typedef void (CV_STDCALL* Cv_iplDeallocate)(IplImage*,int);
01507 typedef IplROI* (CV_STDCALL* Cv_iplCreateROI)(int,int,int,int,int);
01508 typedef IplImage* (CV_STDCALL* Cv_iplCloneImage)(const IplImage*);
01509
01510
01511 CVAPI(void) cvSetIPLAllocators( Cv_iplCreateImageHeader create_header,
01512 Cv_iplAllocateImageData allocate_data,
01513 Cv_iplDeallocate deallocate,
01514 Cv_iplCreateROI create_roi,
01515 Cv_iplCloneImage clone_image );
01516
01517 #define CV_TURN_ON_IPL_COMPATIBILITY() \
01518 cvSetIPLAllocators( iplCreateImageHeader, iplAllocateImage, \
01519 iplDeallocate, iplCreateROI, iplCloneImage )
01520
01521
01522
01523
01524
01525
01526
01527
01528 CVAPI(CvFileStorage*) cvOpenFileStorage( const char* filename,
01529 CvMemStorage* memstorage,
01530 int flags );
01531
01532
01533 CVAPI(void) cvReleaseFileStorage( CvFileStorage** fs );
01534
01535
01536 CVAPI(const char*) cvAttrValue( const CvAttrList* attr, const char* attr_name );
01537
01538
01539 CVAPI(void) cvStartWriteStruct( CvFileStorage* fs, const char* name,
01540 int struct_flags, const char* type_name CV_DEFAULT(NULL),
01541 CvAttrList attributes CV_DEFAULT(cvAttrList()));
01542
01543
01544 CVAPI(void) cvEndWriteStruct( CvFileStorage* fs );
01545
01546
01547 CVAPI(void) cvWriteInt( CvFileStorage* fs, const char* name, int value );
01548
01549
01550 CVAPI(void) cvWriteReal( CvFileStorage* fs, const char* name, double value );
01551
01552
01553 CVAPI(void) cvWriteString( CvFileStorage* fs, const char* name,
01554 const char* str, int quote CV_DEFAULT(0) );
01555
01556
01557 CVAPI(void) cvWriteComment( CvFileStorage* fs, const char* comment,
01558 int eol_comment );
01559
01560
01561
01562 CVAPI(void) cvWrite( CvFileStorage* fs, const char* name, const void* ptr,
01563 CvAttrList attributes CV_DEFAULT(cvAttrList()));
01564
01565
01566 CVAPI(void) cvStartNextStream( CvFileStorage* fs );
01567
01568
01569 CVAPI(void) cvWriteRawData( CvFileStorage* fs, const void* src,
01570 int len, const char* dt );
01571
01572
01573
01574 CVAPI(CvStringHashNode*) cvGetHashedKey( CvFileStorage* fs, const char* name,
01575 int len CV_DEFAULT(-1),
01576 int create_missing CV_DEFAULT(0));
01577
01578
01579
01580 CVAPI(CvFileNode*) cvGetRootFileNode( const CvFileStorage* fs,
01581 int stream_index CV_DEFAULT(0) );
01582
01583
01584
01585 CVAPI(CvFileNode*) cvGetFileNode( CvFileStorage* fs, CvFileNode* map,
01586 const CvStringHashNode* key,
01587 int create_missing CV_DEFAULT(0) );
01588
01589
01590 CVAPI(CvFileNode*) cvGetFileNodeByName( const CvFileStorage* fs,
01591 const CvFileNode* map,
01592 const char* name );
01593
01594 CV_INLINE int cvReadInt( const CvFileNode* node, int default_value CV_DEFAULT(0) )
01595 {
01596 return !node ? default_value :
01597 CV_NODE_IS_INT(node->tag) ? node->data.i :
01598 CV_NODE_IS_REAL(node->tag) ? cvRound(node->data.f) : 0x7fffffff;
01599 }
01600
01601
01602 CV_INLINE int cvReadIntByName( const CvFileStorage* fs, const CvFileNode* map,
01603 const char* name, int default_value CV_DEFAULT(0) )
01604 {
01605 return cvReadInt( cvGetFileNodeByName( fs, map, name ), default_value );
01606 }
01607
01608
01609 CV_INLINE double cvReadReal( const CvFileNode* node, double default_value CV_DEFAULT(0.) )
01610 {
01611 return !node ? default_value :
01612 CV_NODE_IS_INT(node->tag) ? (double)node->data.i :
01613 CV_NODE_IS_REAL(node->tag) ? node->data.f : 1e300;
01614 }
01615
01616
01617 CV_INLINE double cvReadRealByName( const CvFileStorage* fs, const CvFileNode* map,
01618 const char* name, double default_value CV_DEFAULT(0.) )
01619 {
01620 return cvReadReal( cvGetFileNodeByName( fs, map, name ), default_value );
01621 }
01622
01623
01624 CV_INLINE const char* cvReadString( const CvFileNode* node,
01625 const char* default_value CV_DEFAULT(NULL) )
01626 {
01627 return !node ? default_value : CV_NODE_IS_STRING(node->tag) ? node->data.str.ptr : 0;
01628 }
01629
01630
01631 CV_INLINE const char* cvReadStringByName( const CvFileStorage* fs, const CvFileNode* map,
01632 const char* name, const char* default_value CV_DEFAULT(NULL) )
01633 {
01634 return cvReadString( cvGetFileNodeByName( fs, map, name ), default_value );
01635 }
01636
01637
01638
01639 CVAPI(void*) cvRead( CvFileStorage* fs, CvFileNode* node,
01640 CvAttrList* attributes CV_DEFAULT(NULL));
01641
01642
01643 CV_INLINE void* cvReadByName( CvFileStorage* fs, const CvFileNode* map,
01644 const char* name, CvAttrList* attributes CV_DEFAULT(NULL) )
01645 {
01646 return cvRead( fs, cvGetFileNodeByName( fs, map, name ), attributes );
01647 }
01648
01649
01650
01651 CVAPI(void) cvStartReadRawData( const CvFileStorage* fs, const CvFileNode* src,
01652 CvSeqReader* reader );
01653
01654
01655 CVAPI(void) cvReadRawDataSlice( const CvFileStorage* fs, CvSeqReader* reader,
01656 int count, void* dst, const char* dt );
01657
01658
01659 CVAPI(void) cvReadRawData( const CvFileStorage* fs, const CvFileNode* src,
01660 void* dst, const char* dt );
01661
01662
01663 CVAPI(void) cvWriteFileNode( CvFileStorage* fs, const char* new_node_name,
01664 const CvFileNode* node, int embed );
01665
01666
01667 CVAPI(const char*) cvGetFileNodeName( const CvFileNode* node );
01668
01669
01670
01671 CVAPI(void) cvRegisterType( const CvTypeInfo* info );
01672 CVAPI(void) cvUnregisterType( const char* type_name );
01673 CVAPI(CvTypeInfo*) cvFirstType(void);
01674 CVAPI(CvTypeInfo*) cvFindType( const char* type_name );
01675 CVAPI(CvTypeInfo*) cvTypeOf( const void* struct_ptr );
01676
01677
01678 CVAPI(void) cvRelease( void** struct_ptr );
01679 CVAPI(void*) cvClone( const void* struct_ptr );
01680
01681
01682 CVAPI(void) cvSave( const char* filename, const void* struct_ptr,
01683 const char* name CV_DEFAULT(NULL),
01684 const char* comment CV_DEFAULT(NULL),
01685 CvAttrList attributes CV_DEFAULT(cvAttrList()));
01686 CVAPI(void*) cvLoad( const char* filename,
01687 CvMemStorage* memstorage CV_DEFAULT(NULL),
01688 const char* name CV_DEFAULT(NULL),
01689 const char** real_name CV_DEFAULT(NULL) );
01690
01691
01692
01693
01694
01695 CVAPI(int64) cvGetTickCount( void );
01696 CVAPI(double) cvGetTickFrequency( void );
01697
01698
01699
01700 #define CV_CPU_NONE 0
01701 #define CV_CPU_MMX 1
01702 #define CV_CPU_SSE 2
01703 #define CV_CPU_SSE2 3
01704 #define CV_CPU_SSE3 4
01705 #define CV_CPU_SSSE3 5
01706 #define CV_CPU_SSE4_1 6
01707 #define CV_CPU_SSE4_2 7
01708 #define CV_CPU_AVX 10
01709 #define CV_HARDWARE_MAX_FEATURE 255
01710
01711 CVAPI(int) cvCheckHardwareSupport(int feature);
01712
01713
01714
01715
01716 CVAPI(int) cvGetNumThreads( void );
01717 CVAPI(void) cvSetNumThreads( int threads CV_DEFAULT(0) );
01718
01719 CVAPI(int) cvGetThreadNum( void );
01720
01721
01722
01723
01724
01725 CVAPI(int) cvGetErrStatus( void );
01726
01727
01728 CVAPI(void) cvSetErrStatus( int status );
01729
01730 #define CV_ErrModeLeaf 0
01731 #define CV_ErrModeParent 1
01732 #define CV_ErrModeSilent 2
01733
01734
01735 CVAPI(int) cvGetErrMode( void );
01736
01737
01738 CVAPI(int) cvSetErrMode( int mode );
01739
01740
01741
01742
01743 CVAPI(void) cvError( int status, const char* func_name,
01744 const char* err_msg, const char* file_name, int line );
01745
01746
01747 CVAPI(const char*) cvErrorStr( int status );
01748
01749
01750 CVAPI(int) cvGetErrInfo( const char** errcode_desc, const char** description,
01751 const char** filename, int* line );
01752
01753
01754 CVAPI(int) cvErrorFromIppStatus( int ipp_status );
01755
01756 typedef int (CV_CDECL *CvErrorCallback)( int status, const char* func_name,
01757 const char* err_msg, const char* file_name, int line, void* userdata );
01758
01759
01760 CVAPI(CvErrorCallback) cvRedirectError( CvErrorCallback error_handler,
01761 void* userdata CV_DEFAULT(NULL),
01762 void** prev_userdata CV_DEFAULT(NULL) );
01763
01764
01765
01766
01767
01768
01769
01770 CVAPI(int) cvNulDevReport( int status, const char* func_name, const char* err_msg,
01771 const char* file_name, int line, void* userdata );
01772
01773 CVAPI(int) cvStdErrReport( int status, const char* func_name, const char* err_msg,
01774 const char* file_name, int line, void* userdata );
01775
01776 CVAPI(int) cvGuiBoxReport( int status, const char* func_name, const char* err_msg,
01777 const char* file_name, int line, void* userdata );
01778
01779 #define OPENCV_ERROR(status,func,context) \
01780 cvError((status),(func),(context),__FILE__,__LINE__)
01781
01782 #define OPENCV_ERRCHK(func,context) \
01783 {if (cvGetErrStatus() >= 0) \
01784 {OPENCV_ERROR(CV_StsBackTrace,(func),(context));}}
01785
01786 #define OPENCV_ASSERT(expr,func,context) \
01787 {if (! (expr)) \
01788 {OPENCV_ERROR(CV_StsInternal,(func),(context));}}
01789
01790 #define OPENCV_RSTERR() (cvSetErrStatus(CV_StsOk))
01791
01792 #define OPENCV_CALL( Func ) \
01793 { \
01794 Func; \
01795 }
01796
01797
01798
01799 #ifdef CV_NO_FUNC_NAMES
01800 #define CV_FUNCNAME( Name )
01801 #define cvFuncName ""
01802 #else
01803 #define CV_FUNCNAME( Name ) \
01804 static char cvFuncName[] = Name
01805 #endif
01806
01807
01808
01809
01810
01811
01812 #define CV_ERROR( Code, Msg ) \
01813 { \
01814 cvError( (Code), cvFuncName, Msg, __FILE__, __LINE__ ); \
01815 __CV_EXIT__; \
01816 }
01817
01818
01819 #define CV_ERROR_FROM_CODE( code ) \
01820 CV_ERROR( code, "" )
01821
01822
01823
01824
01825
01826
01827 #define CV_CHECK() \
01828 { \
01829 if( cvGetErrStatus() < 0 ) \
01830 CV_ERROR( CV_StsBackTrace, "Inner function failed." ); \
01831 }
01832
01833
01834
01835
01836
01837
01838
01839 #define CV_CALL( Func ) \
01840 { \
01841 Func; \
01842 CV_CHECK(); \
01843 }
01844
01845
01846
01847 #define CV_ASSERT( Condition ) \
01848 { \
01849 if( !(Condition) ) \
01850 CV_ERROR( CV_StsInternal, "Assertion: " #Condition " failed" ); \
01851 }
01852
01853 #define __CV_BEGIN__ {
01854 #define __CV_END__ goto exit; exit: ; }
01855 #define __CV_EXIT__ goto exit
01856
01857 #ifdef __cplusplus
01858 }
01859
01860
01861 struct CV_EXPORTS CvModule
01862 {
01863 CvModule( CvModuleInfo* _info );
01864 ~CvModule();
01865 CvModuleInfo* info;
01866
01867 static CvModuleInfo* first;
01868 static CvModuleInfo* last;
01869 };
01870
01871 struct CV_EXPORTS CvType
01872 {
01873 CvType( const char* type_name,
01874 CvIsInstanceFunc is_instance, CvReleaseFunc release=0,
01875 CvReadFunc read=0, CvWriteFunc write=0, CvCloneFunc clone=0 );
01876 ~CvType();
01877 CvTypeInfo* info;
01878
01879 static CvTypeInfo* first;
01880 static CvTypeInfo* last;
01881 };
01882
01883 #endif
01884
01885 #endif