Cinder

  • Main Page
  • Related Pages
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

include/OpenCV/cxtypes.h

Go to the documentation of this file.
00001 /*M///////////////////////////////////////////////////////////////////////////////////////
00002 //
00003 //  IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
00004 //
00005 //  By downloading, copying, installing or using the software you agree to this license.
00006 //  If you do not agree to this license, do not download, install,
00007 //  copy or use the software.
00008 //
00009 //
00010 //                          License Agreement
00011 //                For Open Source Computer Vision Library
00012 //
00013 // Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
00014 // Copyright (C) 2009, Willow Garage Inc., all rights reserved.
00015 // Third party copyrights are property of their respective owners.
00016 //
00017 // Redistribution and use in source and binary forms, with or without modification,
00018 // are permitted provided that the following conditions are met:
00019 //
00020 //   * Redistribution's of source code must retain the above copyright notice,
00021 //     this list of conditions and the following disclaimer.
00022 //
00023 //   * Redistribution's in binary form must reproduce the above copyright notice,
00024 //     this list of conditions and the following disclaimer in the documentation
00025 //     and/or other materials provided with the distribution.
00026 //
00027 //   * The name of the copyright holders may not be used to endorse or promote products
00028 //     derived from this software without specific prior written permission.
00029 //
00030 // This software is provided by the copyright holders and contributors "as is" and
00031 // any express or implied warranties, including, but not limited to, the implied
00032 // warranties of merchantability and fitness for a particular purpose are disclaimed.
00033 // In no event shall the Intel Corporation or contributors be liable for any direct,
00034 // indirect, incidental, special, exemplary, or consequential damages
00035 // (including, but not limited to, procurement of substitute goods or services;
00036 // loss of use, data, or profits; or business interruption) however caused
00037 // and on any theory of liability, whether in contract, strict liability,
00038 // or tort (including negligence or otherwise) arising in any way out of
00039 // the use of this software, even if advised of the possibility of such damage.
00040 //
00041 //M*/
00042 
00043 #ifndef __OPENCV_CORE_TYPES_H__
00044 #define __OPENCV_CORE_TYPES_H__
00045 
00046 #if !defined _CRT_SECURE_NO_DEPRECATE && _MSC_VER > 1300
00047 #define _CRT_SECURE_NO_DEPRECATE /* to avoid multiple Visual Studio 2005 warnings */
00048 #endif
00049 
00050 
00051 #ifndef SKIP_INCLUDES
00052   #include <assert.h>
00053   #include <stdlib.h>
00054   #include <string.h>
00055   #include <float.h>
00056 
00057 #if !defined _MSC_VER && !defined __BORLANDC__
00058   #include <stdint.h>
00059 #endif
00060 
00061   #if defined __ICL
00062     #define CV_ICC   __ICL
00063   #elif defined __ICC
00064     #define CV_ICC   __ICC
00065   #elif defined __ECL
00066     #define CV_ICC   __ECL
00067   #elif defined __ECC
00068     #define CV_ICC   __ECC
00069   #elif defined __INTEL_COMPILER
00070     #define CV_ICC   __INTEL_COMPILER
00071   #endif
00072 
00073   #if (_MSC_VER >= 1400 && defined _M_X64) || (__GNUC__ >= 4 && defined __x86_64__)
00074     #if defined WIN64
00075         #include <intrin.h>
00076     #endif
00077     #include <emmintrin.h>
00078   #endif
00079 
00080   #if defined __BORLANDC__
00081     #include <fastmath.h>
00082   #else
00083     #include <math.h>
00084   #endif
00085 
00086   #ifdef HAVE_IPL
00087       #ifndef __IPL_H__
00088           #if defined WIN32 || defined _WIN32 || defined WIN64 || defined _WIN64
00089               #include <ipl.h>
00090           #else
00091               #include <ipl/ipl.h>
00092           #endif
00093       #endif
00094   #elif defined __IPL_H__
00095       #define HAVE_IPL
00096   #endif
00097 #endif // SKIP_INCLUDES
00098 
00099 #if defined WIN32 || defined _WIN32 || defined WIN64 || defined _WIN64
00100     #define CV_CDECL __cdecl
00101     #define CV_STDCALL __stdcall
00102 #else
00103     #define CV_CDECL
00104     #define CV_STDCALL
00105 #endif
00106 
00107 #ifndef CV_EXTERN_C
00108     #ifdef __cplusplus
00109         #define CV_EXTERN_C extern "C"
00110         #define CV_DEFAULT(val) = val
00111     #else
00112         #define CV_EXTERN_C
00113         #define CV_DEFAULT(val)
00114     #endif
00115 #endif
00116 
00117 #ifndef CV_EXTERN_C_FUNCPTR
00118     #ifdef __cplusplus
00119         #define CV_EXTERN_C_FUNCPTR(x) extern "C" { typedef x; }
00120     #else
00121         #define CV_EXTERN_C_FUNCPTR(x) typedef x
00122     #endif
00123 #endif
00124 
00125 #ifndef CV_INLINE
00126 #if defined __cplusplus
00127     #define CV_INLINE inline
00128 #elif (defined WIN32 || defined _WIN32 || defined WIN64 || defined _WIN64 || defined WINCE) && !defined __GNUC__
00129     #define CV_INLINE __inline
00130 #else
00131     #define CV_INLINE static
00132 #endif
00133 #endif /* CV_INLINE */
00134 
00135 #if (defined WIN32 || defined _WIN32 || defined WIN64 || defined _WIN64 || defined WINCE) && defined CVAPI_EXPORTS
00136     #define CV_EXPORTS __declspec(dllexport)
00137 #else
00138     #define CV_EXPORTS
00139 #endif
00140 
00141 #ifndef CVAPI
00142     #define CVAPI(rettype) CV_EXTERN_C CV_EXPORTS rettype CV_CDECL
00143 #endif
00144 
00145 #if defined _MSC_VER || defined __BORLANDC__
00146 typedef __int64 int64;
00147 typedef unsigned __int64 uint64;
00148 #else
00149 typedef int64_t int64;
00150 typedef uint64_t uint64;
00151 #endif
00152 
00153 #ifndef HAVE_IPL
00154 typedef unsigned char uchar;
00155 typedef unsigned short ushort;
00156 #endif
00157 
00158 typedef signed char schar;
00159 
00160 /* CvArr* is used to pass arbitrary
00161  * array-like data structures
00162  * into functions where the particular
00163  * array type is recognized at runtime:
00164  */
00165 typedef void CvArr;
00166 
00167 typedef union Cv32suf
00168 {
00169     int i;
00170     unsigned u;
00171     float f;
00172 }
00173 Cv32suf;
00174 
00175 typedef union Cv64suf
00176 {
00177     int64 i;
00178     uint64 u;
00179     double f;
00180 }
00181 Cv64suf;
00182 
00183 /****************************************************************************************\
00184 *                             Common macros and inline functions                         *
00185 \****************************************************************************************/
00186 
00187 #define CV_PI   3.1415926535897932384626433832795
00188 #define CV_LOG2 0.69314718055994530941723212145818
00189 
00190 #define CV_SWAP(a,b,t) ((t) = (a), (a) = (b), (b) = (t))
00191 
00192 #ifndef MIN
00193 #define MIN(a,b)  ((a) > (b) ? (b) : (a))
00194 #endif
00195 
00196 #ifndef MAX
00197 #define MAX(a,b)  ((a) < (b) ? (b) : (a))
00198 #endif
00199 
00200 /* min & max without jumps */
00201 #define  CV_IMIN(a, b)  ((a) ^ (((a)^(b)) & (((a) < (b)) - 1)))
00202 
00203 #define  CV_IMAX(a, b)  ((a) ^ (((a)^(b)) & (((a) > (b)) - 1)))
00204 
00205 /* absolute value without jumps */
00206 #ifndef __cplusplus
00207 #define  CV_IABS(a)     (((a) ^ ((a) < 0 ? -1 : 0)) - ((a) < 0 ? -1 : 0))
00208 #else
00209 #define  CV_IABS(a)     abs(a)
00210 #endif
00211 #define  CV_CMP(a,b)    (((a) > (b)) - ((a) < (b)))
00212 #define  CV_SIGN(a)     CV_CMP((a),0)
00213 
00214 CV_INLINE  int  cvRound( double value )
00215 {
00216 #if (defined _MSC_VER && defined _M_X64) || (defined __GNUC__ && defined __x86_64__ && !defined __APPLE__)
00217     __m128d t = _mm_set_sd( value );
00218     return _mm_cvtsd_si32(t);
00219 #elif defined _MSC_VER && defined _M_IX86
00220     int t;
00221     __asm
00222     {
00223         fld value;
00224         fistp t;
00225     }
00226     return t;
00227 #elif defined HAVE_LRINT || defined CV_ICC || defined __GNUC__
00228     return (int)lrint(value);
00229 #else
00230     // while this is not IEEE754-compliant rounding, it's usually a good enough approximation
00231     return (int)(value + (value >= 0 ? 0.5 : -0.5));
00232 #endif
00233 }
00234 
00235 
00236 CV_INLINE  int  cvFloor( double value )
00237 {
00238 #ifdef __GNUC__
00239     int i = (int)value;
00240     return i - (i > value);
00241 #elif defined _MSC_VER && defined _M_X64
00242     __m128d t = _mm_set_sd( value );
00243     int i = _mm_cvtsd_si32(t);
00244     return i - _mm_movemask_pd(_mm_cmplt_sd(t, _mm_cvtsi32_sd(t,i)));
00245 #else
00246     int i = cvRound(value);
00247     Cv32suf diff;
00248     diff.f = (float)(value - i);
00249     return i - (diff.i < 0);
00250 #endif
00251 }
00252 
00253 
00254 CV_INLINE  int  cvCeil( double value )
00255 {
00256 #ifdef __GNUC__
00257     int i = (int)value;
00258     return i + (i < value);
00259 #elif defined _MSC_VER && defined _M_X64
00260     __m128d t = _mm_set_sd( value );
00261     int i = _mm_cvtsd_si32(t);
00262     return i + _mm_movemask_pd(_mm_cmplt_sd(_mm_cvtsi32_sd(t,i), t));
00263 #else
00264     int i = cvRound(value);
00265     Cv32suf diff;
00266     diff.f = (float)(i - value);
00267     return i + (diff.i < 0);
00268 #endif
00269 }
00270 
00271 #define cvInvSqrt(value) ((float)(1./sqrt(value)))
00272 #define cvSqrt(value)  ((float)sqrt(value))
00273 
00274 CV_INLINE int cvIsNaN( double value )
00275 {
00276 #if 1/*defined _MSC_VER || defined __BORLANDC__
00277     return _isnan(value);
00278 #elif defined __GNUC__
00279     return isnan(value);
00280 #else*/
00281     Cv64suf ieee754;
00282     ieee754.f = value;
00283     return ((unsigned)(ieee754.u >> 32) & 0x7fffffff) +
00284            ((unsigned)ieee754.u != 0) > 0x7ff00000;
00285 #endif
00286 }
00287 
00288 
00289 CV_INLINE int cvIsInf( double value )
00290 {
00291 #if 1/*defined _MSC_VER || defined __BORLANDC__
00292     return !_finite(value);
00293 #elif defined __GNUC__
00294     return isinf(value);
00295 #else*/
00296     Cv64suf ieee754;
00297     ieee754.f = value;
00298     return ((unsigned)(ieee754.u >> 32) & 0x7fffffff) == 0x7ff00000 &&
00299            (unsigned)ieee754.u == 0;
00300 #endif
00301 }
00302 
00303 
00304 /*************** Random number generation *******************/
00305 
00306 typedef uint64 CvRNG;
00307 
00308 CV_INLINE CvRNG cvRNG( int64 seed CV_DEFAULT(-1))
00309 {
00310     CvRNG rng = seed ? (uint64)seed : (uint64)(int64)-1;
00311     return rng;
00312 }
00313 
00314 /* Return random 32-bit unsigned integer: */
00315 CV_INLINE unsigned cvRandInt( CvRNG* rng )
00316 {
00317     uint64 temp = *rng;
00318     temp = (uint64)(unsigned)temp*4164903690U + (temp >> 32);
00319     *rng = temp;
00320     return (unsigned)temp;
00321 }
00322 
00323 /* Returns random floating-point number between 0 and 1: */
00324 CV_INLINE double cvRandReal( CvRNG* rng )
00325 {
00326     return cvRandInt(rng)*2.3283064365386962890625e-10 /* 2^-32 */;
00327 }
00328 
00329 /****************************************************************************************\
00330 *                                  Image type (IplImage)                                 *
00331 \****************************************************************************************/
00332 
00333 #ifndef HAVE_IPL
00334 
00335 /*
00336  * The following definitions (until #endif)
00337  * is an extract from IPL headers.
00338  * Copyright (c) 1995 Intel Corporation.
00339  */
00340 #define IPL_DEPTH_SIGN 0x80000000
00341 
00342 #define IPL_DEPTH_1U     1
00343 #define IPL_DEPTH_8U     8
00344 #define IPL_DEPTH_16U   16
00345 #define IPL_DEPTH_32F   32
00346 
00347 #define IPL_DEPTH_8S  (IPL_DEPTH_SIGN| 8)
00348 #define IPL_DEPTH_16S (IPL_DEPTH_SIGN|16)
00349 #define IPL_DEPTH_32S (IPL_DEPTH_SIGN|32)
00350 
00351 #define IPL_DATA_ORDER_PIXEL  0
00352 #define IPL_DATA_ORDER_PLANE  1
00353 
00354 #define IPL_ORIGIN_TL 0
00355 #define IPL_ORIGIN_BL 1
00356 
00357 #define IPL_ALIGN_4BYTES   4
00358 #define IPL_ALIGN_8BYTES   8
00359 #define IPL_ALIGN_16BYTES 16
00360 #define IPL_ALIGN_32BYTES 32
00361 
00362 #define IPL_ALIGN_DWORD   IPL_ALIGN_4BYTES
00363 #define IPL_ALIGN_QWORD   IPL_ALIGN_8BYTES
00364 
00365 #define IPL_BORDER_CONSTANT   0
00366 #define IPL_BORDER_REPLICATE  1
00367 #define IPL_BORDER_REFLECT    2
00368 #define IPL_BORDER_WRAP       3
00369 
00370 typedef struct _IplImage
00371 {
00372     int  nSize;             /* sizeof(IplImage) */
00373     int  ID;                /* version (=0)*/
00374     int  nChannels;         /* Most of OpenCV functions support 1,2,3 or 4 channels */
00375     int  alphaChannel;      /* Ignored by OpenCV */
00376     int  depth;             /* Pixel depth in bits: IPL_DEPTH_8U, IPL_DEPTH_8S, IPL_DEPTH_16S,
00377                                IPL_DEPTH_32S, IPL_DEPTH_32F and IPL_DEPTH_64F are supported.  */
00378     char colorModel[4];     /* Ignored by OpenCV */
00379     char channelSeq[4];     /* ditto */
00380     int  dataOrder;         /* 0 - interleaved color channels, 1 - separate color channels.
00381                                cvCreateImage can only create interleaved images */
00382     int  origin;            /* 0 - top-left origin,
00383                                1 - bottom-left origin (Windows bitmaps style).  */
00384     int  align;             /* Alignment of image rows (4 or 8).
00385                                OpenCV ignores it and uses widthStep instead.    */
00386     int  width;             /* Image width in pixels.                           */
00387     int  height;            /* Image height in pixels.                          */
00388     struct _IplROI *roi;    /* Image ROI. If NULL, the whole image is selected. */
00389     struct _IplImage *maskROI;      /* Must be NULL. */
00390     void  *imageId;                 /* "           " */
00391     struct _IplTileInfo *tileInfo;  /* "           " */
00392     int  imageSize;         /* Image data size in bytes
00393                                (==image->height*image->widthStep
00394                                in case of interleaved data)*/
00395     char *imageData;        /* Pointer to aligned image data.         */
00396     int  widthStep;         /* Size of aligned image row in bytes.    */
00397     int  BorderMode[4];     /* Ignored by OpenCV.                     */
00398     int  BorderConst[4];    /* Ditto.                                 */
00399     char *imageDataOrigin;  /* Pointer to very origin of image data
00400                                (not necessarily aligned) -
00401                                needed for correct deallocation */
00402 }
00403 IplImage;
00404 
00405 typedef struct _IplTileInfo IplTileInfo;
00406 
00407 typedef struct _IplROI
00408 {
00409     int  coi; /* 0 - no COI (all channels are selected), 1 - 0th channel is selected ...*/
00410     int  xOffset;
00411     int  yOffset;
00412     int  width;
00413     int  height;
00414 }
00415 IplROI;
00416 
00417 typedef struct _IplConvKernel
00418 {
00419     int  nCols;
00420     int  nRows;
00421     int  anchorX;
00422     int  anchorY;
00423     int *values;
00424     int  nShiftR;
00425 }
00426 IplConvKernel;
00427 
00428 typedef struct _IplConvKernelFP
00429 {
00430     int  nCols;
00431     int  nRows;
00432     int  anchorX;
00433     int  anchorY;
00434     float *values;
00435 }
00436 IplConvKernelFP;
00437 
00438 #define IPL_IMAGE_HEADER 1
00439 #define IPL_IMAGE_DATA   2
00440 #define IPL_IMAGE_ROI    4
00441 
00442 #endif/*HAVE_IPL*/
00443 
00444 /* extra border mode */
00445 #define IPL_BORDER_REFLECT_101    4
00446 
00447 #define IPL_IMAGE_MAGIC_VAL  ((int)sizeof(IplImage))
00448 #define CV_TYPE_NAME_IMAGE "opencv-image"
00449 
00450 #define CV_IS_IMAGE_HDR(img) \
00451     ((img) != NULL && ((const IplImage*)(img))->nSize == sizeof(IplImage))
00452 
00453 #define CV_IS_IMAGE(img) \
00454     (CV_IS_IMAGE_HDR(img) && ((IplImage*)img)->imageData != NULL)
00455 
00456 /* for storing double-precision
00457    floating point data in IplImage's */
00458 #define IPL_DEPTH_64F  64
00459 
00460 /* get reference to pixel at (col,row),
00461    for multi-channel images (col) should be multiplied by number of channels */
00462 #define CV_IMAGE_ELEM( image, elemtype, row, col )       \
00463     (((elemtype*)((image)->imageData + (image)->widthStep*(row)))[(col)])
00464 
00465 /****************************************************************************************\
00466 *                                  Matrix type (CvMat)                                   *
00467 \****************************************************************************************/
00468 
00469 #define CV_CN_MAX     64
00470 #define CV_CN_SHIFT   3
00471 #define CV_DEPTH_MAX  (1 << CV_CN_SHIFT)
00472 
00473 #define CV_8U   0
00474 #define CV_8S   1
00475 #define CV_16U  2
00476 #define CV_16S  3
00477 #define CV_32S  4
00478 #define CV_32F  5
00479 #define CV_64F  6
00480 #define CV_USRTYPE1 7
00481 
00482 #define CV_MAT_DEPTH_MASK       (CV_DEPTH_MAX - 1)
00483 #define CV_MAT_DEPTH(flags)     ((flags) & CV_MAT_DEPTH_MASK)
00484 
00485 #define CV_MAKETYPE(depth,cn) (CV_MAT_DEPTH(depth) + (((cn)-1) << CV_CN_SHIFT))
00486 #define CV_MAKE_TYPE CV_MAKETYPE
00487 
00488 #define CV_8UC1 CV_MAKETYPE(CV_8U,1)
00489 #define CV_8UC2 CV_MAKETYPE(CV_8U,2)
00490 #define CV_8UC3 CV_MAKETYPE(CV_8U,3)
00491 #define CV_8UC4 CV_MAKETYPE(CV_8U,4)
00492 #define CV_8UC(n) CV_MAKETYPE(CV_8U,(n))
00493 
00494 #define CV_8SC1 CV_MAKETYPE(CV_8S,1)
00495 #define CV_8SC2 CV_MAKETYPE(CV_8S,2)
00496 #define CV_8SC3 CV_MAKETYPE(CV_8S,3)
00497 #define CV_8SC4 CV_MAKETYPE(CV_8S,4)
00498 #define CV_8SC(n) CV_MAKETYPE(CV_8S,(n))
00499 
00500 #define CV_16UC1 CV_MAKETYPE(CV_16U,1)
00501 #define CV_16UC2 CV_MAKETYPE(CV_16U,2)
00502 #define CV_16UC3 CV_MAKETYPE(CV_16U,3)
00503 #define CV_16UC4 CV_MAKETYPE(CV_16U,4)
00504 #define CV_16UC(n) CV_MAKETYPE(CV_16U,(n))
00505 
00506 #define CV_16SC1 CV_MAKETYPE(CV_16S,1)
00507 #define CV_16SC2 CV_MAKETYPE(CV_16S,2)
00508 #define CV_16SC3 CV_MAKETYPE(CV_16S,3)
00509 #define CV_16SC4 CV_MAKETYPE(CV_16S,4)
00510 #define CV_16SC(n) CV_MAKETYPE(CV_16S,(n))
00511 
00512 #define CV_32SC1 CV_MAKETYPE(CV_32S,1)
00513 #define CV_32SC2 CV_MAKETYPE(CV_32S,2)
00514 #define CV_32SC3 CV_MAKETYPE(CV_32S,3)
00515 #define CV_32SC4 CV_MAKETYPE(CV_32S,4)
00516 #define CV_32SC(n) CV_MAKETYPE(CV_32S,(n))
00517 
00518 #define CV_32FC1 CV_MAKETYPE(CV_32F,1)
00519 #define CV_32FC2 CV_MAKETYPE(CV_32F,2)
00520 #define CV_32FC3 CV_MAKETYPE(CV_32F,3)
00521 #define CV_32FC4 CV_MAKETYPE(CV_32F,4)
00522 #define CV_32FC(n) CV_MAKETYPE(CV_32F,(n))
00523 
00524 #define CV_64FC1 CV_MAKETYPE(CV_64F,1)
00525 #define CV_64FC2 CV_MAKETYPE(CV_64F,2)
00526 #define CV_64FC3 CV_MAKETYPE(CV_64F,3)
00527 #define CV_64FC4 CV_MAKETYPE(CV_64F,4)
00528 #define CV_64FC(n) CV_MAKETYPE(CV_64F,(n))
00529 
00530 #define CV_AUTO_STEP  0x7fffffff
00531 #define CV_WHOLE_ARR  cvSlice( 0, 0x3fffffff )
00532 
00533 #define CV_MAT_CN_MASK          ((CV_CN_MAX - 1) << CV_CN_SHIFT)
00534 #define CV_MAT_CN(flags)        ((((flags) & CV_MAT_CN_MASK) >> CV_CN_SHIFT) + 1)
00535 #define CV_MAT_TYPE_MASK        (CV_DEPTH_MAX*CV_CN_MAX - 1)
00536 #define CV_MAT_TYPE(flags)      ((flags) & CV_MAT_TYPE_MASK)
00537 #define CV_MAT_CONT_FLAG_SHIFT  14
00538 #define CV_MAT_CONT_FLAG        (1 << CV_MAT_CONT_FLAG_SHIFT)
00539 #define CV_IS_MAT_CONT(flags)   ((flags) & CV_MAT_CONT_FLAG)
00540 #define CV_IS_CONT_MAT          CV_IS_MAT_CONT
00541 #define CV_MAT_TEMP_FLAG_SHIFT  15
00542 #define CV_MAT_TEMP_FLAG        (1 << CV_MAT_TEMP_FLAG_SHIFT)
00543 #define CV_IS_TEMP_MAT(flags)   ((flags) & CV_MAT_TEMP_FLAG)
00544 
00545 #define CV_MAGIC_MASK       0xFFFF0000
00546 #define CV_MAT_MAGIC_VAL    0x42420000
00547 #define CV_TYPE_NAME_MAT    "opencv-matrix"
00548 
00549 typedef struct CvMat
00550 {
00551     int type;
00552     int step;
00553 
00554     /* for internal use only */
00555     int* refcount;
00556     int hdr_refcount;
00557 
00558     union
00559     {
00560         uchar* ptr;
00561         short* s;
00562         int* i;
00563         float* fl;
00564         double* db;
00565     } data;
00566 
00567 #ifdef __cplusplus
00568     union
00569     {
00570         int rows;
00571         int height;
00572     };
00573 
00574     union
00575     {
00576         int cols;
00577         int width;
00578     };
00579 #else
00580     int rows;
00581     int cols;
00582 #endif
00583 
00584 }
00585 CvMat;
00586 
00587 
00588 #define CV_IS_MAT_HDR(mat) \
00589     ((mat) != NULL && \
00590     (((const CvMat*)(mat))->type & CV_MAGIC_MASK) == CV_MAT_MAGIC_VAL && \
00591     ((const CvMat*)(mat))->cols > 0 && ((const CvMat*)(mat))->rows > 0)
00592 
00593 #define CV_IS_MAT(mat) \
00594     (CV_IS_MAT_HDR(mat) && ((const CvMat*)(mat))->data.ptr != NULL)
00595 
00596 #define CV_IS_MASK_ARR(mat) \
00597     (((mat)->type & (CV_MAT_TYPE_MASK & ~CV_8SC1)) == 0)
00598 
00599 #define CV_ARE_TYPES_EQ(mat1, mat2) \
00600     ((((mat1)->type ^ (mat2)->type) & CV_MAT_TYPE_MASK) == 0)
00601 
00602 #define CV_ARE_CNS_EQ(mat1, mat2) \
00603     ((((mat1)->type ^ (mat2)->type) & CV_MAT_CN_MASK) == 0)
00604 
00605 #define CV_ARE_DEPTHS_EQ(mat1, mat2) \
00606     ((((mat1)->type ^ (mat2)->type) & CV_MAT_DEPTH_MASK) == 0)
00607 
00608 #define CV_ARE_SIZES_EQ(mat1, mat2) \
00609     ((mat1)->rows == (mat2)->rows && (mat1)->cols == (mat2)->cols)
00610 
00611 #define CV_IS_MAT_CONST(mat)  \
00612     (((mat)->rows|(mat)->cols) == 1)
00613 
00614 /* Size of each channel item,
00615    0x124489 = 1000 0100 0100 0010 0010 0001 0001 ~ array of sizeof(arr_type_elem) */
00616 #define CV_ELEM_SIZE1(type) \
00617     ((((sizeof(size_t)<<28)|0x8442211) >> CV_MAT_DEPTH(type)*4) & 15)
00618 
00619 /* 0x3a50 = 11 10 10 01 01 00 00 ~ array of log2(sizeof(arr_type_elem)) */
00620 #define CV_ELEM_SIZE(type) \
00621     (CV_MAT_CN(type) << ((((sizeof(size_t)/4+1)*16384|0x3a50) >> CV_MAT_DEPTH(type)*2) & 3))
00622 
00623 #define IPL2CV_DEPTH(depth) \
00624     ((((CV_8U)+(CV_16U<<4)+(CV_32F<<8)+(CV_64F<<16)+(CV_8S<<20)+ \
00625     (CV_16S<<24)+(CV_32S<<28)) >> ((((depth) & 0xF0) >> 2) + \
00626     (((depth) & IPL_DEPTH_SIGN) ? 20 : 0))) & 15)
00627 
00628 /* Inline constructor. No data is allocated internally!!!
00629  * (Use together with cvCreateData, or use cvCreateMat instead to
00630  * get a matrix with allocated data):
00631  */
00632 CV_INLINE CvMat cvMat( int rows, int cols, int type, void* data CV_DEFAULT(NULL))
00633 {
00634     CvMat m;
00635 
00636     assert( (unsigned)CV_MAT_DEPTH(type) <= CV_64F );
00637     type = CV_MAT_TYPE(type);
00638     m.type = CV_MAT_MAGIC_VAL | CV_MAT_CONT_FLAG | type;
00639     m.cols = cols;
00640     m.rows = rows;
00641     m.step = m.cols*CV_ELEM_SIZE(type);
00642     m.data.ptr = (uchar*)data;
00643     m.refcount = NULL;
00644     m.hdr_refcount = 0;
00645 
00646     return m;
00647 }
00648 
00649 
00650 #define CV_MAT_ELEM_PTR_FAST( mat, row, col, pix_size )  \
00651     (assert( (unsigned)(row) < (unsigned)(mat).rows &&   \
00652              (unsigned)(col) < (unsigned)(mat).cols ),   \
00653      (mat).data.ptr + (size_t)(mat).step*(row) + (pix_size)*(col))
00654 
00655 #define CV_MAT_ELEM_PTR( mat, row, col )                 \
00656     CV_MAT_ELEM_PTR_FAST( mat, row, col, CV_ELEM_SIZE((mat).type) )
00657 
00658 #define CV_MAT_ELEM( mat, elemtype, row, col )           \
00659     (*(elemtype*)CV_MAT_ELEM_PTR_FAST( mat, row, col, sizeof(elemtype)))
00660 
00661 
00662 CV_INLINE  double  cvmGet( const CvMat* mat, int row, int col )
00663 {
00664     int type;
00665 
00666     type = CV_MAT_TYPE(mat->type);
00667     assert( (unsigned)row < (unsigned)mat->rows &&
00668             (unsigned)col < (unsigned)mat->cols );
00669 
00670     if( type == CV_32FC1 )
00671         return ((float*)(mat->data.ptr + (size_t)mat->step*row))[col];
00672     else
00673     {
00674         assert( type == CV_64FC1 );
00675         return ((double*)(mat->data.ptr + (size_t)mat->step*row))[col];
00676     }
00677 }
00678 
00679 
00680 CV_INLINE  void  cvmSet( CvMat* mat, int row, int col, double value )
00681 {
00682     int type;
00683     type = CV_MAT_TYPE(mat->type);
00684     assert( (unsigned)row < (unsigned)mat->rows &&
00685             (unsigned)col < (unsigned)mat->cols );
00686 
00687     if( type == CV_32FC1 )
00688         ((float*)(mat->data.ptr + (size_t)mat->step*row))[col] = (float)value;
00689     else
00690     {
00691         assert( type == CV_64FC1 );
00692         ((double*)(mat->data.ptr + (size_t)mat->step*row))[col] = (double)value;
00693     }
00694 }
00695 
00696 
00697 CV_INLINE int cvIplDepth( int type )
00698 {
00699     int depth = CV_MAT_DEPTH(type);
00700     return CV_ELEM_SIZE1(depth)*8 | (depth == CV_8S || depth == CV_16S ||
00701            depth == CV_32S ? IPL_DEPTH_SIGN : 0);
00702 }
00703 
00704 
00705 /****************************************************************************************\
00706 *                       Multi-dimensional dense array (CvMatND)                          *
00707 \****************************************************************************************/
00708 
00709 #define CV_MATND_MAGIC_VAL    0x42430000
00710 #define CV_TYPE_NAME_MATND    "opencv-nd-matrix"
00711 
00712 #define CV_MAX_DIM            32
00713 #define CV_MAX_DIM_HEAP       (1 << 16)
00714 
00715 typedef struct CvMatND
00716 {
00717     int type;
00718     int dims;
00719 
00720     int* refcount;
00721     int hdr_refcount;
00722 
00723     union
00724     {
00725         uchar* ptr;
00726         float* fl;
00727         double* db;
00728         int* i;
00729         short* s;
00730     } data;
00731 
00732     struct
00733     {
00734         int size;
00735         int step;
00736     }
00737     dim[CV_MAX_DIM];
00738 }
00739 CvMatND;
00740 
00741 #define CV_IS_MATND_HDR(mat) \
00742     ((mat) != NULL && (((const CvMatND*)(mat))->type & CV_MAGIC_MASK) == CV_MATND_MAGIC_VAL)
00743 
00744 #define CV_IS_MATND(mat) \
00745     (CV_IS_MATND_HDR(mat) && ((const CvMatND*)(mat))->data.ptr != NULL)
00746 
00747 
00748 /****************************************************************************************\
00749 *                      Multi-dimensional sparse array (CvSparseMat)                      *
00750 \****************************************************************************************/
00751 
00752 #define CV_SPARSE_MAT_MAGIC_VAL    0x42440000
00753 #define CV_TYPE_NAME_SPARSE_MAT    "opencv-sparse-matrix"
00754 
00755 struct CvSet;
00756 
00757 typedef struct CvSparseMat
00758 {
00759     int type;
00760     int dims;
00761     int* refcount;
00762     int hdr_refcount;
00763 
00764     struct CvSet* heap;
00765     void** hashtable;
00766     int hashsize;
00767     int valoffset;
00768     int idxoffset;
00769     int size[CV_MAX_DIM];
00770 }
00771 CvSparseMat;
00772 
00773 #define CV_IS_SPARSE_MAT_HDR(mat) \
00774     ((mat) != NULL && \
00775     (((const CvSparseMat*)(mat))->type & CV_MAGIC_MASK) == CV_SPARSE_MAT_MAGIC_VAL)
00776 
00777 #define CV_IS_SPARSE_MAT(mat) \
00778     CV_IS_SPARSE_MAT_HDR(mat)
00779 
00780 /**************** iteration through a sparse array *****************/
00781 
00782 typedef struct CvSparseNode
00783 {
00784     unsigned hashval;
00785     struct CvSparseNode* next;
00786 }
00787 CvSparseNode;
00788 
00789 typedef struct CvSparseMatIterator
00790 {
00791     CvSparseMat* mat;
00792     CvSparseNode* node;
00793     int curidx;
00794 }
00795 CvSparseMatIterator;
00796 
00797 #define CV_NODE_VAL(mat,node)   ((void*)((uchar*)(node) + (mat)->valoffset))
00798 #define CV_NODE_IDX(mat,node)   ((int*)((uchar*)(node) + (mat)->idxoffset))
00799 
00800 /****************************************************************************************\
00801 *                                         Histogram                                      *
00802 \****************************************************************************************/
00803 
00804 typedef int CvHistType;
00805 
00806 #define CV_HIST_MAGIC_VAL     0x42450000
00807 #define CV_HIST_UNIFORM_FLAG  (1 << 10)
00808 
00809 /* indicates whether bin ranges are set already or not */
00810 #define CV_HIST_RANGES_FLAG   (1 << 11)
00811 
00812 #define CV_HIST_ARRAY         0
00813 #define CV_HIST_SPARSE        1
00814 #define CV_HIST_TREE          CV_HIST_SPARSE
00815 
00816 /* should be used as a parameter only,
00817    it turns to CV_HIST_UNIFORM_FLAG of hist->type */
00818 #define CV_HIST_UNIFORM       1
00819 
00820 typedef struct CvHistogram
00821 {
00822     int     type;
00823     CvArr*  bins;
00824     float   thresh[CV_MAX_DIM][2];  /* For uniform histograms.                      */
00825     float** thresh2;                /* For non-uniform histograms.                  */
00826     CvMatND mat;                    /* Embedded matrix header for array histograms. */
00827 }
00828 CvHistogram;
00829 
00830 #define CV_IS_HIST( hist ) \
00831     ((hist) != NULL  && \
00832      (((CvHistogram*)(hist))->type & CV_MAGIC_MASK) == CV_HIST_MAGIC_VAL && \
00833      (hist)->bins != NULL)
00834 
00835 #define CV_IS_UNIFORM_HIST( hist ) \
00836     (((hist)->type & CV_HIST_UNIFORM_FLAG) != 0)
00837 
00838 #define CV_IS_SPARSE_HIST( hist ) \
00839     CV_IS_SPARSE_MAT((hist)->bins)
00840 
00841 #define CV_HIST_HAS_RANGES( hist ) \
00842     (((hist)->type & CV_HIST_RANGES_FLAG) != 0)
00843 
00844 /****************************************************************************************\
00845 *                      Other supplementary data type definitions                         *
00846 \****************************************************************************************/
00847 
00848 /*************************************** CvRect *****************************************/
00849 
00850 typedef struct CvRect
00851 {
00852     int x;
00853     int y;
00854     int width;
00855     int height;
00856 }
00857 CvRect;
00858 
00859 CV_INLINE  CvRect  cvRect( int x, int y, int width, int height )
00860 {
00861     CvRect r;
00862 
00863     r.x = x;
00864     r.y = y;
00865     r.width = width;
00866     r.height = height;
00867 
00868     return r;
00869 }
00870 
00871 
00872 CV_INLINE  IplROI  cvRectToROI( CvRect rect, int coi )
00873 {
00874     IplROI roi;
00875     roi.xOffset = rect.x;
00876     roi.yOffset = rect.y;
00877     roi.width = rect.width;
00878     roi.height = rect.height;
00879     roi.coi = coi;
00880 
00881     return roi;
00882 }
00883 
00884 
00885 CV_INLINE  CvRect  cvROIToRect( IplROI roi )
00886 {
00887     return cvRect( roi.xOffset, roi.yOffset, roi.width, roi.height );
00888 }
00889 
00890 /*********************************** CvTermCriteria *************************************/
00891 
00892 #define CV_TERMCRIT_ITER    1
00893 #define CV_TERMCRIT_NUMBER  CV_TERMCRIT_ITER
00894 #define CV_TERMCRIT_EPS     2
00895 
00896 typedef struct CvTermCriteria
00897 {
00898     int    type;  /* may be combination of
00899                      CV_TERMCRIT_ITER
00900                      CV_TERMCRIT_EPS */
00901     int    max_iter;
00902     double epsilon;
00903 }
00904 CvTermCriteria;
00905 
00906 CV_INLINE  CvTermCriteria  cvTermCriteria( int type, int max_iter, double epsilon )
00907 {
00908     CvTermCriteria t;
00909 
00910     t.type = type;
00911     t.max_iter = max_iter;
00912     t.epsilon = (float)epsilon;
00913 
00914     return t;
00915 }
00916 
00917 
00918 /******************************* CvPoint and variants ***********************************/
00919 
00920 typedef struct CvPoint
00921 {
00922     int x;
00923     int y;
00924 }
00925 CvPoint;
00926 
00927 
00928 CV_INLINE  CvPoint  cvPoint( int x, int y )
00929 {
00930     CvPoint p;
00931 
00932     p.x = x;
00933     p.y = y;
00934 
00935     return p;
00936 }
00937 
00938 
00939 typedef struct CvPoint2D32f
00940 {
00941     float x;
00942     float y;
00943 }
00944 CvPoint2D32f;
00945 
00946 
00947 CV_INLINE  CvPoint2D32f  cvPoint2D32f( double x, double y )
00948 {
00949     CvPoint2D32f p;
00950 
00951     p.x = (float)x;
00952     p.y = (float)y;
00953 
00954     return p;
00955 }
00956 
00957 
00958 CV_INLINE  CvPoint2D32f  cvPointTo32f( CvPoint point )
00959 {
00960     return cvPoint2D32f( (float)point.x, (float)point.y );
00961 }
00962 
00963 
00964 CV_INLINE  CvPoint  cvPointFrom32f( CvPoint2D32f point )
00965 {
00966     CvPoint ipt;
00967     ipt.x = cvRound(point.x);
00968     ipt.y = cvRound(point.y);
00969 
00970     return ipt;
00971 }
00972 
00973 
00974 typedef struct CvPoint3D32f
00975 {
00976     float x;
00977     float y;
00978     float z;
00979 }
00980 CvPoint3D32f;
00981 
00982 
00983 CV_INLINE  CvPoint3D32f  cvPoint3D32f( double x, double y, double z )
00984 {
00985     CvPoint3D32f p;
00986 
00987     p.x = (float)x;
00988     p.y = (float)y;
00989     p.z = (float)z;
00990 
00991     return p;
00992 }
00993 
00994 
00995 typedef struct CvPoint2D64f
00996 {
00997     double x;
00998     double y;
00999 }
01000 CvPoint2D64f;
01001 
01002 
01003 CV_INLINE  CvPoint2D64f  cvPoint2D64f( double x, double y )
01004 {
01005     CvPoint2D64f p;
01006 
01007     p.x = x;
01008     p.y = y;
01009 
01010     return p;
01011 }
01012 
01013 
01014 typedef struct CvPoint3D64f
01015 {
01016     double x;
01017     double y;
01018     double z;
01019 }
01020 CvPoint3D64f;
01021 
01022 
01023 CV_INLINE  CvPoint3D64f  cvPoint3D64f( double x, double y, double z )
01024 {
01025     CvPoint3D64f p;
01026 
01027     p.x = x;
01028     p.y = y;
01029     p.z = z;
01030 
01031     return p;
01032 }
01033 
01034 
01035 /******************************** CvSize's & CvBox **************************************/
01036 
01037 typedef struct
01038 {
01039     int width;
01040     int height;
01041 }
01042 CvSize;
01043 
01044 CV_INLINE  CvSize  cvSize( int width, int height )
01045 {
01046     CvSize s;
01047 
01048     s.width = width;
01049     s.height = height;
01050 
01051     return s;
01052 }
01053 
01054 typedef struct CvSize2D32f
01055 {
01056     float width;
01057     float height;
01058 }
01059 CvSize2D32f;
01060 
01061 
01062 CV_INLINE  CvSize2D32f  cvSize2D32f( double width, double height )
01063 {
01064     CvSize2D32f s;
01065 
01066     s.width = (float)width;
01067     s.height = (float)height;
01068 
01069     return s;
01070 }
01071 
01072 typedef struct CvBox2D
01073 {
01074     CvPoint2D32f center;  /* Center of the box.                          */
01075     CvSize2D32f  size;    /* Box width and length.                       */
01076     float angle;          /* Angle between the horizontal axis           */
01077                           /* and the first side (i.e. length) in degrees */
01078 }
01079 CvBox2D;
01080 
01081 
01082 /* Line iterator state: */
01083 typedef struct CvLineIterator
01084 {
01085     /* Pointer to the current point: */
01086     uchar* ptr;
01087 
01088     /* Bresenham algorithm state: */
01089     int  err;
01090     int  plus_delta;
01091     int  minus_delta;
01092     int  plus_step;
01093     int  minus_step;
01094 }
01095 CvLineIterator;
01096 
01097 
01098 
01099 /************************************* CvSlice ******************************************/
01100 
01101 typedef struct CvSlice
01102 {
01103     int  start_index, end_index;
01104 }
01105 CvSlice;
01106 
01107 CV_INLINE  CvSlice  cvSlice( int start, int end )
01108 {
01109     CvSlice slice;
01110     slice.start_index = start;
01111     slice.end_index = end;
01112 
01113     return slice;
01114 }
01115 
01116 #define CV_WHOLE_SEQ_END_INDEX 0x3fffffff
01117 #define CV_WHOLE_SEQ  cvSlice(0, CV_WHOLE_SEQ_END_INDEX)
01118 
01119 
01120 /************************************* CvScalar *****************************************/
01121 
01122 typedef struct CvScalar
01123 {
01124     double val[4];
01125 }
01126 CvScalar;
01127 
01128 CV_INLINE  CvScalar  cvScalar( double val0, double val1 CV_DEFAULT(0),
01129                                double val2 CV_DEFAULT(0), double val3 CV_DEFAULT(0))
01130 {
01131     CvScalar scalar;
01132     scalar.val[0] = val0; scalar.val[1] = val1;
01133     scalar.val[2] = val2; scalar.val[3] = val3;
01134     return scalar;
01135 }
01136 
01137 
01138 CV_INLINE  CvScalar  cvRealScalar( double val0 )
01139 {
01140     CvScalar scalar;
01141     scalar.val[0] = val0;
01142     scalar.val[1] = scalar.val[2] = scalar.val[3] = 0;
01143     return scalar;
01144 }
01145 
01146 CV_INLINE  CvScalar  cvScalarAll( double val0123 )
01147 {
01148     CvScalar scalar;
01149     scalar.val[0] = val0123;
01150     scalar.val[1] = val0123;
01151     scalar.val[2] = val0123;
01152     scalar.val[3] = val0123;
01153     return scalar;
01154 }
01155 
01156 /****************************************************************************************\
01157 *                                   Dynamic Data structures                              *
01158 \****************************************************************************************/
01159 
01160 /******************************** Memory storage ****************************************/
01161 
01162 typedef struct CvMemBlock
01163 {
01164     struct CvMemBlock*  prev;
01165     struct CvMemBlock*  next;
01166 }
01167 CvMemBlock;
01168 
01169 #define CV_STORAGE_MAGIC_VAL    0x42890000
01170 
01171 typedef struct CvMemStorage
01172 {
01173     int signature;
01174     CvMemBlock* bottom;           /* First allocated block.                   */
01175     CvMemBlock* top;              /* Current memory block - top of the stack. */
01176     struct  CvMemStorage* parent; /* We get new blocks from parent as needed. */
01177     int block_size;               /* Block size.                              */
01178     int free_space;               /* Remaining free space in current block.   */
01179 }
01180 CvMemStorage;
01181 
01182 #define CV_IS_STORAGE(storage)  \
01183     ((storage) != NULL &&       \
01184     (((CvMemStorage*)(storage))->signature & CV_MAGIC_MASK) == CV_STORAGE_MAGIC_VAL)
01185 
01186 
01187 typedef struct CvMemStoragePos
01188 {
01189     CvMemBlock* top;
01190     int free_space;
01191 }
01192 CvMemStoragePos;
01193 
01194 
01195 /*********************************** Sequence *******************************************/
01196 
01197 typedef struct CvSeqBlock
01198 {
01199     struct CvSeqBlock*  prev; /* Previous sequence block.                   */
01200     struct CvSeqBlock*  next; /* Next sequence block.                       */
01201   int    start_index;         /* Index of the first element in the block +  */
01202                               /* sequence->first->start_index.              */
01203     int    count;             /* Number of elements in the block.           */
01204     schar* data;              /* Pointer to the first element of the block. */
01205 }
01206 CvSeqBlock;
01207 
01208 
01209 #define CV_TREE_NODE_FIELDS(node_type)                               \
01210     int       flags;             /* Miscellaneous flags.     */      \
01211     int       header_size;       /* Size of sequence header. */      \
01212     struct    node_type* h_prev; /* Previous sequence.       */      \
01213     struct    node_type* h_next; /* Next sequence.           */      \
01214     struct    node_type* v_prev; /* 2nd previous sequence.   */      \
01215     struct    node_type* v_next  /* 2nd next sequence.       */
01216 
01217 /*
01218    Read/Write sequence.
01219    Elements can be dynamically inserted to or deleted from the sequence.
01220 */
01221 #define CV_SEQUENCE_FIELDS()                                              \
01222     CV_TREE_NODE_FIELDS(CvSeq);                                           \
01223     int       total;          /* Total number of elements.            */  \
01224     int       elem_size;      /* Size of sequence element in bytes.   */  \
01225     schar*    block_max;      /* Maximal bound of the last block.     */  \
01226     schar*    ptr;            /* Current write pointer.               */  \
01227     int       delta_elems;    /* Grow seq this many at a time.        */  \
01228     CvMemStorage* storage;    /* Where the seq is stored.             */  \
01229     CvSeqBlock* free_blocks;  /* Free blocks list.                    */  \
01230     CvSeqBlock* first;        /* Pointer to the first sequence block. */
01231 
01232 typedef struct CvSeq
01233 {
01234     CV_SEQUENCE_FIELDS()
01235 }
01236 CvSeq;
01237 
01238 #define CV_TYPE_NAME_SEQ             "opencv-sequence"
01239 #define CV_TYPE_NAME_SEQ_TREE        "opencv-sequence-tree"
01240 
01241 /*************************************** Set ********************************************/
01242 /*
01243   Set.
01244   Order is not preserved. There can be gaps between sequence elements.
01245   After the element has been inserted it stays in the same place all the time.
01246   The MSB(most-significant or sign bit) of the first field (flags) is 0 iff the element exists.
01247 */
01248 #define CV_SET_ELEM_FIELDS(elem_type)   \
01249     int  flags;                         \
01250     struct elem_type* next_free;
01251 
01252 typedef struct CvSetElem
01253 {
01254     CV_SET_ELEM_FIELDS(CvSetElem)
01255 }
01256 CvSetElem;
01257 
01258 #define CV_SET_FIELDS()      \
01259     CV_SEQUENCE_FIELDS()     \
01260     CvSetElem* free_elems;   \
01261     int active_count;
01262 
01263 typedef struct CvSet
01264 {
01265     CV_SET_FIELDS()
01266 }
01267 CvSet;
01268 
01269 
01270 #define CV_SET_ELEM_IDX_MASK   ((1 << 26) - 1)
01271 #define CV_SET_ELEM_FREE_FLAG  (1 << (sizeof(int)*8-1))
01272 
01273 /* Checks whether the element pointed by ptr belongs to a set or not */
01274 #define CV_IS_SET_ELEM( ptr )  (((CvSetElem*)(ptr))->flags >= 0)
01275 
01276 /************************************* Graph ********************************************/
01277 
01278 /*
01279   We represent a graph as a set of vertices.
01280   Vertices contain their adjacency lists (more exactly, pointers to first incoming or
01281   outcoming edge (or 0 if isolated vertex)). Edges are stored in another set.
01282   There is a singly-linked list of incoming/outcoming edges for each vertex.
01283 
01284   Each edge consists of
01285 
01286      o   Two pointers to the starting and ending vertices
01287          (vtx[0] and vtx[1] respectively).
01288 
01289      A graph may be oriented or not. In the latter case, edges between
01290      vertex i to vertex j are not distinguished during search operations.
01291 
01292      o   Two pointers to next edges for the starting and ending vertices, where
01293          next[0] points to the next edge in the vtx[0] adjacency list and
01294          next[1] points to the next edge in the vtx[1] adjacency list.
01295 */
01296 #define CV_GRAPH_EDGE_FIELDS()      \
01297     int flags;                      \
01298     float weight;                   \
01299     struct CvGraphEdge* next[2];    \
01300     struct CvGraphVtx* vtx[2];
01301 
01302 
01303 #define CV_GRAPH_VERTEX_FIELDS()    \
01304     int flags;                      \
01305     struct CvGraphEdge* first;
01306 
01307 
01308 typedef struct CvGraphEdge
01309 {
01310     CV_GRAPH_EDGE_FIELDS()
01311 }
01312 CvGraphEdge;
01313 
01314 typedef struct CvGraphVtx
01315 {
01316     CV_GRAPH_VERTEX_FIELDS()
01317 }
01318 CvGraphVtx;
01319 
01320 typedef struct CvGraphVtx2D
01321 {
01322     CV_GRAPH_VERTEX_FIELDS()
01323     CvPoint2D32f* ptr;
01324 }
01325 CvGraphVtx2D;
01326 
01327 /*
01328    Graph is "derived" from the set (this is set a of vertices)
01329    and includes another set (edges)
01330 */
01331 #define  CV_GRAPH_FIELDS()   \
01332     CV_SET_FIELDS()          \
01333     CvSet* edges;
01334 
01335 typedef struct CvGraph
01336 {
01337     CV_GRAPH_FIELDS()
01338 }
01339 CvGraph;
01340 
01341 #define CV_TYPE_NAME_GRAPH "opencv-graph"
01342 
01343 /*********************************** Chain/Countour *************************************/
01344 
01345 typedef struct CvChain
01346 {
01347     CV_SEQUENCE_FIELDS()
01348     CvPoint  origin;
01349 }
01350 CvChain;
01351 
01352 #define CV_CONTOUR_FIELDS()  \
01353     CV_SEQUENCE_FIELDS()     \
01354     CvRect rect;             \
01355     int color;               \
01356     int reserved[3];
01357 
01358 typedef struct CvContour
01359 {
01360     CV_CONTOUR_FIELDS()
01361 }
01362 CvContour;
01363 
01364 typedef CvContour CvPoint2DSeq;
01365 
01366 /****************************************************************************************\
01367 *                                    Sequence types                                      *
01368 \****************************************************************************************/
01369 
01370 #define CV_SEQ_MAGIC_VAL             0x42990000
01371 
01372 #define CV_IS_SEQ(seq) \
01373     ((seq) != NULL && (((CvSeq*)(seq))->flags & CV_MAGIC_MASK) == CV_SEQ_MAGIC_VAL)
01374 
01375 #define CV_SET_MAGIC_VAL             0x42980000
01376 #define CV_IS_SET(set) \
01377     ((set) != NULL && (((CvSeq*)(set))->flags & CV_MAGIC_MASK) == CV_SET_MAGIC_VAL)
01378 
01379 #define CV_SEQ_ELTYPE_BITS           9
01380 #define CV_SEQ_ELTYPE_MASK           ((1 << CV_SEQ_ELTYPE_BITS) - 1)
01381 
01382 #define CV_SEQ_ELTYPE_POINT          CV_32SC2  /* (x,y) */
01383 #define CV_SEQ_ELTYPE_CODE           CV_8UC1   /* freeman code: 0..7 */
01384 #define CV_SEQ_ELTYPE_GENERIC        0
01385 #define CV_SEQ_ELTYPE_PTR            CV_USRTYPE1
01386 #define CV_SEQ_ELTYPE_PPOINT         CV_SEQ_ELTYPE_PTR  /* &(x,y) */
01387 #define CV_SEQ_ELTYPE_INDEX          CV_32SC1  /* #(x,y) */
01388 #define CV_SEQ_ELTYPE_GRAPH_EDGE     0  /* &next_o, &next_d, &vtx_o, &vtx_d */
01389 #define CV_SEQ_ELTYPE_GRAPH_VERTEX   0  /* first_edge, &(x,y) */
01390 #define CV_SEQ_ELTYPE_TRIAN_ATR      0  /* vertex of the binary tree   */
01391 #define CV_SEQ_ELTYPE_CONNECTED_COMP 0  /* connected component  */
01392 #define CV_SEQ_ELTYPE_POINT3D        CV_32FC3  /* (x,y,z)  */
01393 
01394 #define CV_SEQ_KIND_BITS        3
01395 #define CV_SEQ_KIND_MASK        (((1 << CV_SEQ_KIND_BITS) - 1)<<CV_SEQ_ELTYPE_BITS)
01396 
01397 /* types of sequences */
01398 #define CV_SEQ_KIND_GENERIC     (0 << CV_SEQ_ELTYPE_BITS)
01399 #define CV_SEQ_KIND_CURVE       (1 << CV_SEQ_ELTYPE_BITS)
01400 #define CV_SEQ_KIND_BIN_TREE    (2 << CV_SEQ_ELTYPE_BITS)
01401 
01402 /* types of sparse sequences (sets) */
01403 #define CV_SEQ_KIND_GRAPH       (3 << CV_SEQ_ELTYPE_BITS)
01404 #define CV_SEQ_KIND_SUBDIV2D    (4 << CV_SEQ_ELTYPE_BITS)
01405 
01406 #define CV_SEQ_FLAG_SHIFT       (CV_SEQ_KIND_BITS + CV_SEQ_ELTYPE_BITS)
01407 
01408 /* flags for curves */
01409 #define CV_SEQ_FLAG_CLOSED     (1 << CV_SEQ_FLAG_SHIFT)
01410 #define CV_SEQ_FLAG_SIMPLE     (2 << CV_SEQ_FLAG_SHIFT)
01411 #define CV_SEQ_FLAG_CONVEX     (4 << CV_SEQ_FLAG_SHIFT)
01412 #define CV_SEQ_FLAG_HOLE       (8 << CV_SEQ_FLAG_SHIFT)
01413 
01414 /* flags for graphs */
01415 #define CV_GRAPH_FLAG_ORIENTED (1 << CV_SEQ_FLAG_SHIFT)
01416 
01417 #define CV_GRAPH               CV_SEQ_KIND_GRAPH
01418 #define CV_ORIENTED_GRAPH      (CV_SEQ_KIND_GRAPH|CV_GRAPH_FLAG_ORIENTED)
01419 
01420 /* point sets */
01421 #define CV_SEQ_POINT_SET       (CV_SEQ_KIND_GENERIC| CV_SEQ_ELTYPE_POINT)
01422 #define CV_SEQ_POINT3D_SET     (CV_SEQ_KIND_GENERIC| CV_SEQ_ELTYPE_POINT3D)
01423 #define CV_SEQ_POLYLINE        (CV_SEQ_KIND_CURVE  | CV_SEQ_ELTYPE_POINT)
01424 #define CV_SEQ_POLYGON         (CV_SEQ_FLAG_CLOSED | CV_SEQ_POLYLINE )
01425 #define CV_SEQ_CONTOUR         CV_SEQ_POLYGON
01426 #define CV_SEQ_SIMPLE_POLYGON  (CV_SEQ_FLAG_SIMPLE | CV_SEQ_POLYGON  )
01427 
01428 /* chain-coded curves */
01429 #define CV_SEQ_CHAIN           (CV_SEQ_KIND_CURVE  | CV_SEQ_ELTYPE_CODE)
01430 #define CV_SEQ_CHAIN_CONTOUR   (CV_SEQ_FLAG_CLOSED | CV_SEQ_CHAIN)
01431 
01432 /* binary tree for the contour */
01433 #define CV_SEQ_POLYGON_TREE    (CV_SEQ_KIND_BIN_TREE  | CV_SEQ_ELTYPE_TRIAN_ATR)
01434 
01435 /* sequence of the connected components */
01436 #define CV_SEQ_CONNECTED_COMP  (CV_SEQ_KIND_GENERIC  | CV_SEQ_ELTYPE_CONNECTED_COMP)
01437 
01438 /* sequence of the integer numbers */
01439 #define CV_SEQ_INDEX           (CV_SEQ_KIND_GENERIC  | CV_SEQ_ELTYPE_INDEX)
01440 
01441 #define CV_SEQ_ELTYPE( seq )   ((seq)->flags & CV_SEQ_ELTYPE_MASK)
01442 #define CV_SEQ_KIND( seq )     ((seq)->flags & CV_SEQ_KIND_MASK )
01443 
01444 /* flag checking */
01445 #define CV_IS_SEQ_INDEX( seq )      ((CV_SEQ_ELTYPE(seq) == CV_SEQ_ELTYPE_INDEX) && \
01446                                      (CV_SEQ_KIND(seq) == CV_SEQ_KIND_GENERIC))
01447 
01448 #define CV_IS_SEQ_CURVE( seq )      (CV_SEQ_KIND(seq) == CV_SEQ_KIND_CURVE)
01449 #define CV_IS_SEQ_CLOSED( seq )     (((seq)->flags & CV_SEQ_FLAG_CLOSED) != 0)
01450 #define CV_IS_SEQ_CONVEX( seq )     (((seq)->flags & CV_SEQ_FLAG_CONVEX) != 0)
01451 #define CV_IS_SEQ_HOLE( seq )       (((seq)->flags & CV_SEQ_FLAG_HOLE) != 0)
01452 #define CV_IS_SEQ_SIMPLE( seq )     ((((seq)->flags & CV_SEQ_FLAG_SIMPLE) != 0) || \
01453                                     CV_IS_SEQ_CONVEX(seq))
01454 
01455 /* type checking macros */
01456 #define CV_IS_SEQ_POINT_SET( seq ) \
01457     ((CV_SEQ_ELTYPE(seq) == CV_32SC2 || CV_SEQ_ELTYPE(seq) == CV_32FC2))
01458 
01459 #define CV_IS_SEQ_POINT_SUBSET( seq ) \
01460     (CV_IS_SEQ_INDEX( seq ) || CV_SEQ_ELTYPE(seq) == CV_SEQ_ELTYPE_PPOINT)
01461 
01462 #define CV_IS_SEQ_POLYLINE( seq )   \
01463     (CV_SEQ_KIND(seq) == CV_SEQ_KIND_CURVE && CV_IS_SEQ_POINT_SET(seq))
01464 
01465 #define CV_IS_SEQ_POLYGON( seq )   \
01466     (CV_IS_SEQ_POLYLINE(seq) && CV_IS_SEQ_CLOSED(seq))
01467 
01468 #define CV_IS_SEQ_CHAIN( seq )   \
01469     (CV_SEQ_KIND(seq) == CV_SEQ_KIND_CURVE && (seq)->elem_size == 1)
01470 
01471 #define CV_IS_SEQ_CONTOUR( seq )   \
01472     (CV_IS_SEQ_CLOSED(seq) && (CV_IS_SEQ_POLYLINE(seq) || CV_IS_SEQ_CHAIN(seq)))
01473 
01474 #define CV_IS_SEQ_CHAIN_CONTOUR( seq ) \
01475     (CV_IS_SEQ_CHAIN( seq ) && CV_IS_SEQ_CLOSED( seq ))
01476 
01477 #define CV_IS_SEQ_POLYGON_TREE( seq ) \
01478     (CV_SEQ_ELTYPE (seq) ==  CV_SEQ_ELTYPE_TRIAN_ATR &&    \
01479     CV_SEQ_KIND( seq ) ==  CV_SEQ_KIND_BIN_TREE )
01480 
01481 #define CV_IS_GRAPH( seq )    \
01482     (CV_IS_SET(seq) && CV_SEQ_KIND((CvSet*)(seq)) == CV_SEQ_KIND_GRAPH)
01483 
01484 #define CV_IS_GRAPH_ORIENTED( seq )   \
01485     (((seq)->flags & CV_GRAPH_FLAG_ORIENTED) != 0)
01486 
01487 #define CV_IS_SUBDIV2D( seq )  \
01488     (CV_IS_SET(seq) && CV_SEQ_KIND((CvSet*)(seq)) == CV_SEQ_KIND_SUBDIV2D)
01489 
01490 /****************************************************************************************/
01491 /*                            Sequence writer & reader                                  */
01492 /****************************************************************************************/
01493 
01494 #define CV_SEQ_WRITER_FIELDS()                                     \
01495     int          header_size;                                      \
01496     CvSeq*       seq;        /* the sequence written */            \
01497     CvSeqBlock*  block;      /* current block */                   \
01498     schar*       ptr;        /* pointer to free space */           \
01499     schar*       block_min;  /* pointer to the beginning of block*/\
01500     schar*       block_max;  /* pointer to the end of block */
01501 
01502 typedef struct CvSeqWriter
01503 {
01504     CV_SEQ_WRITER_FIELDS()
01505 }
01506 CvSeqWriter;
01507 
01508 
01509 #define CV_SEQ_READER_FIELDS()                                      \
01510     int          header_size;                                       \
01511     CvSeq*       seq;        /* sequence, beign read */             \
01512     CvSeqBlock*  block;      /* current block */                    \
01513     schar*       ptr;        /* pointer to element be read next */  \
01514     schar*       block_min;  /* pointer to the beginning of block */\
01515     schar*       block_max;  /* pointer to the end of block */      \
01516     int          delta_index;/* = seq->first->start_index   */      \
01517     schar*       prev_elem;  /* pointer to previous element */
01518 
01519 
01520 typedef struct CvSeqReader
01521 {
01522     CV_SEQ_READER_FIELDS()
01523 }
01524 CvSeqReader;
01525 
01526 /****************************************************************************************/
01527 /*                                Operations on sequences                               */
01528 /****************************************************************************************/
01529 
01530 #define  CV_SEQ_ELEM( seq, elem_type, index )                    \
01531 /* assert gives some guarantee that <seq> parameter is valid */  \
01532 (   assert(sizeof((seq)->first[0]) == sizeof(CvSeqBlock) &&      \
01533     (seq)->elem_size == sizeof(elem_type)),                      \
01534     (elem_type*)((seq)->first && (unsigned)index <               \
01535     (unsigned)((seq)->first->count) ?                            \
01536     (seq)->first->data + (index) * sizeof(elem_type) :           \
01537     cvGetSeqElem( (CvSeq*)(seq), (index) )))
01538 #define CV_GET_SEQ_ELEM( elem_type, seq, index ) CV_SEQ_ELEM( (seq), elem_type, (index) )
01539 
01540 /* Add element to sequence: */
01541 #define CV_WRITE_SEQ_ELEM_VAR( elem_ptr, writer )     \
01542 {                                                     \
01543     if( (writer).ptr >= (writer).block_max )          \
01544     {                                                 \
01545         cvCreateSeqBlock( &writer);                   \
01546     }                                                 \
01547     memcpy((writer).ptr, elem_ptr, (writer).seq->elem_size);\
01548     (writer).ptr += (writer).seq->elem_size;          \
01549 }
01550 
01551 #define CV_WRITE_SEQ_ELEM( elem, writer )             \
01552 {                                                     \
01553     assert( (writer).seq->elem_size == sizeof(elem)); \
01554     if( (writer).ptr >= (writer).block_max )          \
01555     {                                                 \
01556         cvCreateSeqBlock( &writer);                   \
01557     }                                                 \
01558     assert( (writer).ptr <= (writer).block_max - sizeof(elem));\
01559     memcpy((writer).ptr, &(elem), sizeof(elem));      \
01560     (writer).ptr += sizeof(elem);                     \
01561 }
01562 
01563 
01564 /* Move reader position forward: */
01565 #define CV_NEXT_SEQ_ELEM( elem_size, reader )                 \
01566 {                                                             \
01567     if( ((reader).ptr += (elem_size)) >= (reader).block_max ) \
01568     {                                                         \
01569         cvChangeSeqBlock( &(reader), 1 );                     \
01570     }                                                         \
01571 }
01572 
01573 
01574 /* Move reader position backward: */
01575 #define CV_PREV_SEQ_ELEM( elem_size, reader )                \
01576 {                                                            \
01577     if( ((reader).ptr -= (elem_size)) < (reader).block_min ) \
01578     {                                                        \
01579         cvChangeSeqBlock( &(reader), -1 );                   \
01580     }                                                        \
01581 }
01582 
01583 /* Read element and move read position forward: */
01584 #define CV_READ_SEQ_ELEM( elem, reader )                       \
01585 {                                                              \
01586     assert( (reader).seq->elem_size == sizeof(elem));          \
01587     memcpy( &(elem), (reader).ptr, sizeof((elem)));            \
01588     CV_NEXT_SEQ_ELEM( sizeof(elem), reader )                   \
01589 }
01590 
01591 /* Read element and move read position backward: */
01592 #define CV_REV_READ_SEQ_ELEM( elem, reader )                     \
01593 {                                                                \
01594     assert( (reader).seq->elem_size == sizeof(elem));            \
01595     memcpy(&(elem), (reader).ptr, sizeof((elem)));               \
01596     CV_PREV_SEQ_ELEM( sizeof(elem), reader )                     \
01597 }
01598 
01599 
01600 #define CV_READ_CHAIN_POINT( _pt, reader )                              \
01601 {                                                                       \
01602     (_pt) = (reader).pt;                                                \
01603     if( (reader).ptr )                                                  \
01604     {                                                                   \
01605         CV_READ_SEQ_ELEM( (reader).code, (reader));                     \
01606         assert( ((reader).code & ~7) == 0 );                            \
01607         (reader).pt.x += (reader).deltas[(int)(reader).code][0];        \
01608         (reader).pt.y += (reader).deltas[(int)(reader).code][1];        \
01609     }                                                                   \
01610 }
01611 
01612 #define CV_CURRENT_POINT( reader )  (*((CvPoint*)((reader).ptr)))
01613 #define CV_PREV_POINT( reader )     (*((CvPoint*)((reader).prev_elem)))
01614 
01615 #define CV_READ_EDGE( pt1, pt2, reader )               \
01616 {                                                      \
01617     assert( sizeof(pt1) == sizeof(CvPoint) &&          \
01618             sizeof(pt2) == sizeof(CvPoint) &&          \
01619             reader.seq->elem_size == sizeof(CvPoint)); \
01620     (pt1) = CV_PREV_POINT( reader );                   \
01621     (pt2) = CV_CURRENT_POINT( reader );                \
01622     (reader).prev_elem = (reader).ptr;                 \
01623     CV_NEXT_SEQ_ELEM( sizeof(CvPoint), (reader));      \
01624 }
01625 
01626 /************ Graph macros ************/
01627 
01628 /* Return next graph edge for given vertex: */
01629 #define  CV_NEXT_GRAPH_EDGE( edge, vertex )                              \
01630      (assert((edge)->vtx[0] == (vertex) || (edge)->vtx[1] == (vertex)),  \
01631       (edge)->next[(edge)->vtx[1] == (vertex)])
01632 
01633 
01634 
01635 /****************************************************************************************\
01636 *             Data structures for persistence (a.k.a serialization) functionality        *
01637 \****************************************************************************************/
01638 
01639 /* "black box" file storage */
01640 typedef struct CvFileStorage CvFileStorage;
01641 
01642 /* Storage flags: */
01643 #define CV_STORAGE_READ          0
01644 #define CV_STORAGE_WRITE         1
01645 #define CV_STORAGE_WRITE_TEXT    CV_STORAGE_WRITE
01646 #define CV_STORAGE_WRITE_BINARY  CV_STORAGE_WRITE
01647 #define CV_STORAGE_APPEND        2
01648 
01649 /* List of attributes: */
01650 typedef struct CvAttrList
01651 {
01652     const char** attr;         /* NULL-terminated array of (attribute_name,attribute_value) pairs. */
01653     struct CvAttrList* next;   /* Pointer to next chunk of the attributes list.                    */
01654 }
01655 CvAttrList;
01656 
01657 CV_INLINE CvAttrList cvAttrList( const char** attr CV_DEFAULT(NULL),
01658                                  CvAttrList* next CV_DEFAULT(NULL) )
01659 {
01660     CvAttrList l;
01661     l.attr = attr;
01662     l.next = next;
01663 
01664     return l;
01665 }
01666 
01667 struct CvTypeInfo;
01668 
01669 #define CV_NODE_NONE        0
01670 #define CV_NODE_INT         1
01671 #define CV_NODE_INTEGER     CV_NODE_INT
01672 #define CV_NODE_REAL        2
01673 #define CV_NODE_FLOAT       CV_NODE_REAL
01674 #define CV_NODE_STR         3
01675 #define CV_NODE_STRING      CV_NODE_STR
01676 #define CV_NODE_REF         4 /* not used */
01677 #define CV_NODE_SEQ         5
01678 #define CV_NODE_MAP         6
01679 #define CV_NODE_TYPE_MASK   7
01680 
01681 #define CV_NODE_TYPE(flags)  ((flags) & CV_NODE_TYPE_MASK)
01682 
01683 /* file node flags */
01684 #define CV_NODE_FLOW        8 /* Used only for writing structures in YAML format. */
01685 #define CV_NODE_USER        16
01686 #define CV_NODE_EMPTY       32
01687 #define CV_NODE_NAMED       64
01688 
01689 #define CV_NODE_IS_INT(flags)        (CV_NODE_TYPE(flags) == CV_NODE_INT)
01690 #define CV_NODE_IS_REAL(flags)       (CV_NODE_TYPE(flags) == CV_NODE_REAL)
01691 #define CV_NODE_IS_STRING(flags)     (CV_NODE_TYPE(flags) == CV_NODE_STRING)
01692 #define CV_NODE_IS_SEQ(flags)        (CV_NODE_TYPE(flags) == CV_NODE_SEQ)
01693 #define CV_NODE_IS_MAP(flags)        (CV_NODE_TYPE(flags) == CV_NODE_MAP)
01694 #define CV_NODE_IS_COLLECTION(flags) (CV_NODE_TYPE(flags) >= CV_NODE_SEQ)
01695 #define CV_NODE_IS_FLOW(flags)       (((flags) & CV_NODE_FLOW) != 0)
01696 #define CV_NODE_IS_EMPTY(flags)      (((flags) & CV_NODE_EMPTY) != 0)
01697 #define CV_NODE_IS_USER(flags)       (((flags) & CV_NODE_USER) != 0)
01698 #define CV_NODE_HAS_NAME(flags)      (((flags) & CV_NODE_NAMED) != 0)
01699 
01700 #define CV_NODE_SEQ_SIMPLE 256
01701 #define CV_NODE_SEQ_IS_SIMPLE(seq) (((seq)->flags & CV_NODE_SEQ_SIMPLE) != 0)
01702 
01703 typedef struct CvString
01704 {
01705     int len;
01706     char* ptr;
01707 }
01708 CvString;
01709 
01710 /* All the keys (names) of elements in the readed file storage
01711    are stored in the hash to speed up the lookup operations: */
01712 typedef struct CvStringHashNode
01713 {
01714     unsigned hashval;
01715     CvString str;
01716     struct CvStringHashNode* next;
01717 }
01718 CvStringHashNode;
01719 
01720 typedef struct CvGenericHash CvFileNodeHash;
01721 
01722 /* Basic element of the file storage - scalar or collection: */
01723 typedef struct CvFileNode
01724 {
01725     int tag;
01726     struct CvTypeInfo* info; /* type information
01727             (only for user-defined object, for others it is 0) */
01728     union
01729     {
01730         double f; /* scalar floating-point number */
01731         int i;    /* scalar integer number */
01732         CvString str; /* text string */
01733         CvSeq* seq; /* sequence (ordered collection of file nodes) */
01734         CvFileNodeHash* map; /* map (collection of named file nodes) */
01735     } data;
01736 }
01737 CvFileNode;
01738 
01739 #ifdef __cplusplus
01740 extern "C" {
01741 #endif
01742 typedef int (CV_CDECL *CvIsInstanceFunc)( const void* struct_ptr );
01743 typedef void (CV_CDECL *CvReleaseFunc)( void** struct_dblptr );
01744 typedef void* (CV_CDECL *CvReadFunc)( CvFileStorage* storage, CvFileNode* node );
01745 typedef void (CV_CDECL *CvWriteFunc)( CvFileStorage* storage, const char* name,
01746                                       const void* struct_ptr, CvAttrList attributes );
01747 typedef void* (CV_CDECL *CvCloneFunc)( const void* struct_ptr );
01748 #ifdef __cplusplus
01749 }
01750 #endif
01751 
01752 typedef struct CvTypeInfo
01753 {
01754     int flags;
01755     int header_size;
01756     struct CvTypeInfo* prev;
01757     struct CvTypeInfo* next;
01758     const char* type_name;
01759     CvIsInstanceFunc is_instance;
01760     CvReleaseFunc release;
01761     CvReadFunc read;
01762     CvWriteFunc write;
01763     CvCloneFunc clone;
01764 }
01765 CvTypeInfo;
01766 
01767 
01768 /**** System data types ******/
01769 
01770 typedef struct CvPluginFuncInfo
01771 {
01772     void** func_addr;
01773     void* default_func_addr;
01774     const char* func_names;
01775     int search_modules;
01776     int loaded_from;
01777 }
01778 CvPluginFuncInfo;
01779 
01780 typedef struct CvModuleInfo
01781 {
01782     struct CvModuleInfo* next;
01783     const char* name;
01784     const char* version;
01785     CvPluginFuncInfo* func_tab;
01786 }
01787 CvModuleInfo;
01788 
01789 #endif /*_CXCORE_TYPES_H_*/
01790 
01791 /* End of file. */