types_c.h
Go to the documentation of this file.
1 /*M///////////////////////////////////////////////////////////////////////////////////////
2 //
3 // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
4 //
5 // By downloading, copying, installing or using the software you agree to this license.
6 // If you do not agree to this license, do not download, install,
7 // copy or use the software.
8 //
9 //
10 // License Agreement
11 // For Open Source Computer Vision Library
12 //
13 // Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
14 // Copyright (C) 2009, Willow Garage Inc., all rights reserved.
15 // Third party copyrights are property of their respective owners.
16 //
17 // Redistribution and use in source and binary forms, with or without modification,
18 // are permitted provided that the following conditions are met:
19 //
20 // * Redistribution's of source code must retain the above copyright notice,
21 // this list of conditions and the following disclaimer.
22 //
23 // * Redistribution's in binary form must reproduce the above copyright notice,
24 // this list of conditions and the following disclaimer in the documentation
25 // and/or other materials provided with the distribution.
26 //
27 // * The name of the copyright holders may not be used to endorse or promote products
28 // derived from this software without specific prior written permission.
29 //
30 // This software is provided by the copyright holders and contributors "as is" and
31 // any express or implied warranties, including, but not limited to, the implied
32 // warranties of merchantability and fitness for a particular purpose are disclaimed.
33 // In no event shall the Intel Corporation or contributors be liable for any direct,
34 // indirect, incidental, special, exemplary, or consequential damages
35 // (including, but not limited to, procurement of substitute goods or services;
36 // loss of use, data, or profits; or business interruption) however caused
37 // and on any theory of liability, whether in contract, strict liability,
38 // or tort (including negligence or otherwise) arising in any way out of
39 // the use of this software, even if advised of the possibility of such damage.
40 //
41 //M*/
42 
43 #ifndef __OPENCV_CORE_TYPES_H__
44 #define __OPENCV_CORE_TYPES_H__
45 
46 #if !defined _CRT_SECURE_NO_DEPRECATE && defined _MSC_VER
47 # if _MSC_VER > 1300
48 # define _CRT_SECURE_NO_DEPRECATE /* to avoid multiple Visual Studio 2005 warnings */
49 # endif
50 #endif
51 
52 
53 #ifndef SKIP_INCLUDES
54 
55 #include <assert.h>
56 #include <stdlib.h>
57 #include <string.h>
58 #include <float.h>
59 
60 #if !defined _MSC_VER && !defined __BORLANDC__
61 # include <stdint.h>
62 #endif
63 
64 #if defined __ICL
65 # define CV_ICC __ICL
66 #elif defined __ICC
67 # define CV_ICC __ICC
68 #elif defined __ECL
69 # define CV_ICC __ECL
70 #elif defined __ECC
71 # define CV_ICC __ECC
72 #elif defined __INTEL_COMPILER
73 # define CV_ICC __INTEL_COMPILER
74 #endif
75 
76 #if defined CV_ICC && !defined CV_ENABLE_UNROLLED
77 # define CV_ENABLE_UNROLLED 0
78 #else
79 # define CV_ENABLE_UNROLLED 1
80 #endif
81 
82 #if (defined _M_X64 && defined _MSC_VER && _MSC_VER >= 1400) || (__GNUC__ >= 4 && defined __x86_64__)
83 # if defined WIN32
84 # include <intrin.h>
85 # endif
86 # if defined __SSE2__ || !defined __GNUC__
87 # include <emmintrin.h>
88 # endif
89 #endif
90 
91 #if defined __BORLANDC__
92 # include <fastmath.h>
93 #else
94 # include <math.h>
95 #endif
96 
97 #ifdef HAVE_IPL
98 # ifndef __IPL_H__
99 # if defined WIN32 || defined _WIN32
100 # include <ipl.h>
101 # else
102 # include <ipl/ipl.h>
103 # endif
104 # endif
105 #elif defined __IPL_H__
106 # define HAVE_IPL
107 #endif
108 
109 #endif // SKIP_INCLUDES
110 
111 #if defined WIN32 || defined _WIN32
112 # define CV_CDECL __cdecl
113 # define CV_STDCALL __stdcall
114 #else
115 # define CV_CDECL
116 # define CV_STDCALL
117 #endif
118 
119 #ifndef CV_EXTERN_C
120 # ifdef __cplusplus
121 # define CV_EXTERN_C extern "C"
122 # define CV_DEFAULT(val) = val
123 # else
124 # define CV_EXTERN_C
125 # define CV_DEFAULT(val)
126 # endif
127 #endif
128 
129 #ifndef CV_EXTERN_C_FUNCPTR
130 # ifdef __cplusplus
131 # define CV_EXTERN_C_FUNCPTR(x) extern "C" { typedef x; }
132 # else
133 # define CV_EXTERN_C_FUNCPTR(x) typedef x
134 # endif
135 #endif
136 
137 #ifndef CV_INLINE
138 # if defined __cplusplus
139 # define CV_INLINE inline
140 # elif defined _MSC_VER
141 # define CV_INLINE __inline
142 # else
143 # define CV_INLINE static
144 # endif
145 #endif /* CV_INLINE */
146 
147 #if (defined WIN32 || defined _WIN32 || defined WINCE) && defined CVAPI_EXPORTS
148 # define CV_EXPORTS __declspec(dllexport)
149 #else
150 # define CV_EXPORTS
151 #endif
152 
153 #ifndef CVAPI
154 # define CVAPI(rettype) CV_EXTERN_C CV_EXPORTS rettype CV_CDECL
155 #endif
156 
157 #if defined _MSC_VER || defined __BORLANDC__
158  typedef __int64 int64;
159  typedef unsigned __int64 uint64;
160 # define CV_BIG_INT(n) n##I64
161 # define CV_BIG_UINT(n) n##UI64
162 #else
163  typedef int64_t int64;
164  typedef uint64_t uint64;
165 # define CV_BIG_INT(n) n##LL
166 # define CV_BIG_UINT(n) n##ULL
167 #endif
168 
169 #ifndef HAVE_IPL
170  typedef unsigned char uchar;
171  typedef unsigned short ushort;
172 #endif
173 
174 typedef signed char schar;
175 
176 /* special informative macros for wrapper generators */
177 #define CV_CARRAY(counter)
178 #define CV_CUSTOM_CARRAY(args)
179 #define CV_EXPORTS_W CV_EXPORTS
180 #define CV_EXPORTS_W_SIMPLE CV_EXPORTS
181 #define CV_EXPORTS_AS(synonym) CV_EXPORTS
182 #define CV_EXPORTS_W_MAP CV_EXPORTS
183 #define CV_IN_OUT
184 #define CV_OUT
185 #define CV_PROP
186 #define CV_PROP_RW
187 #define CV_WRAP
188 #define CV_WRAP_AS(synonym)
189 #define CV_WRAP_DEFAULT(value)
190 
191 /* CvArr* is used to pass arbitrary
192  * array-like data structures
193  * into functions where the particular
194  * array type is recognized at runtime:
195  */
196 typedef void CvArr;
197 
198 typedef union Cv32suf
199 {
200  int i;
201  unsigned u;
202  float f;
203 }
204 Cv32suf;
205 
206 typedef union Cv64suf
207 {
210  double f;
211 }
212 Cv64suf;
213 
214 typedef int CVStatus;
215 
216 enum {
217  CV_StsOk= 0, /* everithing is ok */
218  CV_StsBackTrace= -1, /* pseudo error for back trace */
219  CV_StsError= -2, /* unknown /unspecified error */
220  CV_StsInternal= -3, /* internal error (bad state) */
221  CV_StsNoMem= -4, /* insufficient memory */
222  CV_StsBadArg= -5, /* function arg/param is bad */
223  CV_StsBadFunc= -6, /* unsupported function */
224  CV_StsNoConv= -7, /* iter. didn't converge */
225  CV_StsAutoTrace= -8, /* tracing */
226  CV_HeaderIsNull= -9, /* image header is NULL */
227  CV_BadImageSize= -10, /* image size is invalid */
228  CV_BadOffset= -11, /* offset is invalid */
230  CV_BadStep= -13,
234  CV_BadDepth= -17,
236  CV_BadOrder= -19,
238  CV_BadAlign= -21,
241  CV_BadCOI= -24,
244  CV_StsNullPtr= -27, /* null pointer */
245  CV_StsVecLengthErr= -28, /* incorrect vector length */
246  CV_StsFilterStructContentErr= -29, /* incorr. filter structure content */
247  CV_StsKernelStructContentErr= -30, /* incorr. transform kernel content */
248  CV_StsFilterOffsetErr= -31, /* incorrect filter offset value */
249  CV_StsBadSize= -201, /* the input/output structure size is incorrect */
250  CV_StsDivByZero= -202, /* division by zero */
251  CV_StsInplaceNotSupported= -203, /* in-place operation is not supported */
252  CV_StsObjectNotFound= -204, /* request can't be completed */
253  CV_StsUnmatchedFormats= -205, /* formats of input/output arrays differ */
254  CV_StsBadFlag= -206, /* flag is wrong or not supported */
255  CV_StsBadPoint= -207, /* bad CvPoint */
256  CV_StsBadMask= -208, /* bad format of mask (neither 8uC1 nor 8sC1)*/
257  CV_StsUnmatchedSizes= -209, /* sizes of input/output structures do not match */
258  CV_StsUnsupportedFormat= -210, /* the data format/type is not supported by the function*/
259  CV_StsOutOfRange= -211, /* some of parameters are out of range */
260  CV_StsParseError= -212, /* invalid syntax/structure of the parsed file */
261  CV_StsNotImplemented= -213, /* the requested function/feature is not implemented */
262  CV_StsBadMemBlock= -214, /* an allocated block has been corrupted */
263  CV_StsAssert= -215, /* assertion failed */
271 };
272 
273 /****************************************************************************************\
274 * Common macros and inline functions *
275 \****************************************************************************************/
276 
277 #ifdef HAVE_TEGRA_OPTIMIZATION
278 # include "tegra_round.hpp"
279 #endif
280 
281 #define CV_PI 3.1415926535897932384626433832795
282 #define CV_LOG2 0.69314718055994530941723212145818
283 
284 #define CV_SWAP(a,b,t) ((t) = (a), (a) = (b), (b) = (t))
285 
286 #ifndef MIN
287 # define MIN(a,b) ((a) > (b) ? (b) : (a))
288 #endif
289 
290 #ifndef MAX
291 # define MAX(a,b) ((a) < (b) ? (b) : (a))
292 #endif
293 
294 /* min & max without jumps */
295 #define CV_IMIN(a, b) ((a) ^ (((a)^(b)) & (((a) < (b)) - 1)))
296 
297 #define CV_IMAX(a, b) ((a) ^ (((a)^(b)) & (((a) > (b)) - 1)))
298 
299 /* absolute value without jumps */
300 #ifndef __cplusplus
301 # define CV_IABS(a) (((a) ^ ((a) < 0 ? -1 : 0)) - ((a) < 0 ? -1 : 0))
302 #else
303 # define CV_IABS(a) abs(a)
304 #endif
305 #define CV_CMP(a,b) (((a) > (b)) - ((a) < (b)))
306 #define CV_SIGN(a) CV_CMP((a),0)
307 
308 CV_INLINE int cvRound( double value )
309 {
310 #if (defined _MSC_VER && defined _M_X64) || (defined __GNUC__ && defined __x86_64__ && defined __SSE2__ && !defined __APPLE__)
311  __m128d t = _mm_set_sd( value );
312  return _mm_cvtsd_si32(t);
313 #elif defined _MSC_VER && defined _M_IX86
314  int t;
315  __asm
316  {
317  fld value;
318  fistp t;
319  }
320  return t;
321 #elif defined _MSC_VER && defined _M_ARM && defined HAVE_TEGRA_OPTIMIZATION
322  TEGRA_ROUND(value);
323 #elif defined CV_ICC || defined __GNUC__
324 # ifdef HAVE_TEGRA_OPTIMIZATION
325  TEGRA_ROUND(value);
326 # else
327  return (int)lrint(value);
328 # endif
329 #else
330  double intpart, fractpart;
331  fractpart = modf(value, &intpart);
332  if ((fabs(fractpart) != 0.5) || ((((int)intpart) % 2) != 0))
333  return (int)(value + (value >= 0 ? 0.5 : -0.5));
334  else
335  return (int)intpart;
336 #endif
337 }
338 
339 #if defined __SSE2__ || (defined _M_IX86_FP && 2 == _M_IX86_FP)
340 # include "emmintrin.h"
341 #endif
342 
343 CV_INLINE int cvFloor( double value )
344 {
345 #if defined _MSC_VER && defined _M_X64 || (defined __GNUC__ && defined __SSE2__ && !defined __APPLE__)
346  __m128d t = _mm_set_sd( value );
347  int i = _mm_cvtsd_si32(t);
348  return i - _mm_movemask_pd(_mm_cmplt_sd(t, _mm_cvtsi32_sd(t,i)));
349 #elif defined __GNUC__
350  int i = (int)value;
351  return i - (i > value);
352 #else
353  int i = cvRound(value);
354  float diff = (float)(value - i);
355  return i - (diff < 0);
356 #endif
357 }
358 
359 
360 CV_INLINE int cvCeil( double value )
361 {
362 #if defined _MSC_VER && defined _M_X64 || (defined __GNUC__ && defined __SSE2__&& !defined __APPLE__)
363  __m128d t = _mm_set_sd( value );
364  int i = _mm_cvtsd_si32(t);
365  return i + _mm_movemask_pd(_mm_cmplt_sd(_mm_cvtsi32_sd(t,i), t));
366 #elif defined __GNUC__
367  int i = (int)value;
368  return i + (i < value);
369 #else
370  int i = cvRound(value);
371  float diff = (float)(i - value);
372  return i + (diff < 0);
373 #endif
374 }
375 
376 #define cvInvSqrt(value) ((float)(1./sqrt(value)))
377 #define cvSqrt(value) ((float)sqrt(value))
378 
379 CV_INLINE int cvIsNaN( double value )
380 {
381  Cv64suf ieee754;
382  ieee754.f = value;
383  return ((unsigned)(ieee754.u >> 32) & 0x7fffffff) +
384  ((unsigned)ieee754.u != 0) > 0x7ff00000;
385 }
386 
387 
388 CV_INLINE int cvIsInf( double value )
389 {
390  Cv64suf ieee754;
391  ieee754.f = value;
392  return ((unsigned)(ieee754.u >> 32) & 0x7fffffff) == 0x7ff00000 &&
393  (unsigned)ieee754.u == 0;
394 }
395 
396 
397 /*************** Random number generation *******************/
398 
399 typedef uint64 CvRNG;
400 
401 #define CV_RNG_COEFF 4164903690U
402 
403 CV_INLINE CvRNG cvRNG( int64 seed CV_DEFAULT(-1))
404 {
405  CvRNG rng = seed ? (uint64)seed : (uint64)(int64)-1;
406  return rng;
407 }
408 
409 /* Return random 32-bit unsigned integer: */
410 CV_INLINE unsigned cvRandInt( CvRNG* rng )
411 {
412  uint64 temp = *rng;
413  temp = (uint64)(unsigned)temp*CV_RNG_COEFF + (temp >> 32);
414  *rng = temp;
415  return (unsigned)temp;
416 }
417 
418 /* Returns random floating-point number between 0 and 1: */
419 CV_INLINE double cvRandReal( CvRNG* rng )
420 {
421  return cvRandInt(rng)*2.3283064365386962890625e-10 /* 2^-32 */;
422 }
423 
424 /****************************************************************************************\
425 * Image type (IplImage) *
426 \****************************************************************************************/
427 
428 #ifndef HAVE_IPL
429 
430 /*
431  * The following definitions (until #endif)
432  * is an extract from IPL headers.
433  * Copyright (c) 1995 Intel Corporation.
434  */
435 #define IPL_DEPTH_SIGN 0x80000000
436 
437 #define IPL_DEPTH_1U 1
438 #define IPL_DEPTH_8U 8
439 #define IPL_DEPTH_16U 16
440 #define IPL_DEPTH_32F 32
441 
442 #define IPL_DEPTH_8S (IPL_DEPTH_SIGN| 8)
443 #define IPL_DEPTH_16S (IPL_DEPTH_SIGN|16)
444 #define IPL_DEPTH_32S (IPL_DEPTH_SIGN|32)
445 
446 #define IPL_DATA_ORDER_PIXEL 0
447 #define IPL_DATA_ORDER_PLANE 1
448 
449 #define IPL_ORIGIN_TL 0
450 #define IPL_ORIGIN_BL 1
451 
452 #define IPL_ALIGN_4BYTES 4
453 #define IPL_ALIGN_8BYTES 8
454 #define IPL_ALIGN_16BYTES 16
455 #define IPL_ALIGN_32BYTES 32
456 
457 #define IPL_ALIGN_DWORD IPL_ALIGN_4BYTES
458 #define IPL_ALIGN_QWORD IPL_ALIGN_8BYTES
459 
460 #define IPL_BORDER_CONSTANT 0
461 #define IPL_BORDER_REPLICATE 1
462 #define IPL_BORDER_REFLECT 2
463 #define IPL_BORDER_WRAP 3
464 
465 typedef struct _IplImage
466 {
467  int nSize; /* sizeof(IplImage) */
468  int ID; /* version (=0)*/
469  int nChannels; /* Most of OpenCV functions support 1,2,3 or 4 channels */
470  int alphaChannel; /* Ignored by OpenCV */
471  int depth; /* Pixel depth in bits: IPL_DEPTH_8U, IPL_DEPTH_8S, IPL_DEPTH_16S,
472  IPL_DEPTH_32S, IPL_DEPTH_32F and IPL_DEPTH_64F are supported. */
473  char colorModel[4]; /* Ignored by OpenCV */
474  char channelSeq[4]; /* ditto */
475  int dataOrder; /* 0 - interleaved color channels, 1 - separate color channels.
476  cvCreateImage can only create interleaved images */
477  int origin; /* 0 - top-left origin,
478  1 - bottom-left origin (Windows bitmaps style). */
479  int align; /* Alignment of image rows (4 or 8).
480  OpenCV ignores it and uses widthStep instead. */
481  int width; /* Image width in pixels. */
482  int height; /* Image height in pixels. */
483  struct _IplROI *roi; /* Image ROI. If NULL, the whole image is selected. */
484  struct _IplImage *maskROI; /* Must be NULL. */
485  void *imageId; /* " " */
486  struct _IplTileInfo *tileInfo; /* " " */
487  int imageSize; /* Image data size in bytes
488  (==image->height*image->widthStep
489  in case of interleaved data)*/
490  char *imageData; /* Pointer to aligned image data. */
491  int widthStep; /* Size of aligned image row in bytes. */
492  int BorderMode[4]; /* Ignored by OpenCV. */
493  int BorderConst[4]; /* Ditto. */
494  char *imageDataOrigin; /* Pointer to very origin of image data
495  (not necessarily aligned) -
496  needed for correct deallocation */
497 }
498 IplImage;
499 
500 typedef struct _IplTileInfo IplTileInfo;
501 
502 typedef struct _IplROI
503 {
504  int coi; /* 0 - no COI (all channels are selected), 1 - 0th channel is selected ...*/
505  int xOffset;
506  int yOffset;
507  int width;
508  int height;
509 }
510 IplROI;
511 
512 typedef struct _IplConvKernel
513 {
514  int nCols;
515  int nRows;
516  int anchorX;
517  int anchorY;
518  int *values;
519  int nShiftR;
520 }
522 
523 typedef struct _IplConvKernelFP
524 {
525  int nCols;
526  int nRows;
527  int anchorX;
528  int anchorY;
529  float *values;
530 }
532 
533 #define IPL_IMAGE_HEADER 1
534 #define IPL_IMAGE_DATA 2
535 #define IPL_IMAGE_ROI 4
536 
537 #endif/*HAVE_IPL*/
538 
539 /* extra border mode */
540 #define IPL_BORDER_REFLECT_101 4
541 #define IPL_BORDER_TRANSPARENT 5
542 
543 #define IPL_IMAGE_MAGIC_VAL ((int)sizeof(IplImage))
544 #define CV_TYPE_NAME_IMAGE "opencv-image"
545 
546 #define CV_IS_IMAGE_HDR(img) \
547  ((img) != NULL && ((const IplImage*)(img))->nSize == sizeof(IplImage))
548 
549 #define CV_IS_IMAGE(img) \
550  (CV_IS_IMAGE_HDR(img) && ((IplImage*)img)->imageData != NULL)
551 
552 /* for storing double-precision
553  floating point data in IplImage's */
554 #define IPL_DEPTH_64F 64
555 
556 /* get reference to pixel at (col,row),
557  for multi-channel images (col) should be multiplied by number of channels */
558 #define CV_IMAGE_ELEM( image, elemtype, row, col ) \
559  (((elemtype*)((image)->imageData + (image)->widthStep*(row)))[(col)])
560 
561 /****************************************************************************************\
562 * Matrix type (CvMat) *
563 \****************************************************************************************/
564 
565 #define CV_CN_MAX 512
566 #define CV_CN_SHIFT 3
567 #define CV_DEPTH_MAX (1 << CV_CN_SHIFT)
568 
569 #define CV_8U 0
570 #define CV_8S 1
571 #define CV_16U 2
572 #define CV_16S 3
573 #define CV_32S 4
574 #define CV_32F 5
575 #define CV_64F 6
576 #define CV_USRTYPE1 7
577 
578 #define CV_MAT_DEPTH_MASK (CV_DEPTH_MAX - 1)
579 #define CV_MAT_DEPTH(flags) ((flags) & CV_MAT_DEPTH_MASK)
580 
581 #define CV_MAKETYPE(depth,cn) (CV_MAT_DEPTH(depth) + (((cn)-1) << CV_CN_SHIFT))
582 #define CV_MAKE_TYPE CV_MAKETYPE
583 
584 #define CV_8UC1 CV_MAKETYPE(CV_8U,1)
585 #define CV_8UC2 CV_MAKETYPE(CV_8U,2)
586 #define CV_8UC3 CV_MAKETYPE(CV_8U,3)
587 #define CV_8UC4 CV_MAKETYPE(CV_8U,4)
588 #define CV_8UC(n) CV_MAKETYPE(CV_8U,(n))
589 
590 #define CV_8SC1 CV_MAKETYPE(CV_8S,1)
591 #define CV_8SC2 CV_MAKETYPE(CV_8S,2)
592 #define CV_8SC3 CV_MAKETYPE(CV_8S,3)
593 #define CV_8SC4 CV_MAKETYPE(CV_8S,4)
594 #define CV_8SC(n) CV_MAKETYPE(CV_8S,(n))
595 
596 #define CV_16UC1 CV_MAKETYPE(CV_16U,1)
597 #define CV_16UC2 CV_MAKETYPE(CV_16U,2)
598 #define CV_16UC3 CV_MAKETYPE(CV_16U,3)
599 #define CV_16UC4 CV_MAKETYPE(CV_16U,4)
600 #define CV_16UC(n) CV_MAKETYPE(CV_16U,(n))
601 
602 #define CV_16SC1 CV_MAKETYPE(CV_16S,1)
603 #define CV_16SC2 CV_MAKETYPE(CV_16S,2)
604 #define CV_16SC3 CV_MAKETYPE(CV_16S,3)
605 #define CV_16SC4 CV_MAKETYPE(CV_16S,4)
606 #define CV_16SC(n) CV_MAKETYPE(CV_16S,(n))
607 
608 #define CV_32SC1 CV_MAKETYPE(CV_32S,1)
609 #define CV_32SC2 CV_MAKETYPE(CV_32S,2)
610 #define CV_32SC3 CV_MAKETYPE(CV_32S,3)
611 #define CV_32SC4 CV_MAKETYPE(CV_32S,4)
612 #define CV_32SC(n) CV_MAKETYPE(CV_32S,(n))
613 
614 #define CV_32FC1 CV_MAKETYPE(CV_32F,1)
615 #define CV_32FC2 CV_MAKETYPE(CV_32F,2)
616 #define CV_32FC3 CV_MAKETYPE(CV_32F,3)
617 #define CV_32FC4 CV_MAKETYPE(CV_32F,4)
618 #define CV_32FC(n) CV_MAKETYPE(CV_32F,(n))
619 
620 #define CV_64FC1 CV_MAKETYPE(CV_64F,1)
621 #define CV_64FC2 CV_MAKETYPE(CV_64F,2)
622 #define CV_64FC3 CV_MAKETYPE(CV_64F,3)
623 #define CV_64FC4 CV_MAKETYPE(CV_64F,4)
624 #define CV_64FC(n) CV_MAKETYPE(CV_64F,(n))
625 
626 #define CV_AUTO_STEP 0x7fffffff
627 #define CV_WHOLE_ARR cvSlice( 0, 0x3fffffff )
628 
629 #define CV_MAT_CN_MASK ((CV_CN_MAX - 1) << CV_CN_SHIFT)
630 #define CV_MAT_CN(flags) ((((flags) & CV_MAT_CN_MASK) >> CV_CN_SHIFT) + 1)
631 #define CV_MAT_TYPE_MASK (CV_DEPTH_MAX*CV_CN_MAX - 1)
632 #define CV_MAT_TYPE(flags) ((flags) & CV_MAT_TYPE_MASK)
633 #define CV_MAT_CONT_FLAG_SHIFT 14
634 #define CV_MAT_CONT_FLAG (1 << CV_MAT_CONT_FLAG_SHIFT)
635 #define CV_IS_MAT_CONT(flags) ((flags) & CV_MAT_CONT_FLAG)
636 #define CV_IS_CONT_MAT CV_IS_MAT_CONT
637 #define CV_SUBMAT_FLAG_SHIFT 15
638 #define CV_SUBMAT_FLAG (1 << CV_SUBMAT_FLAG_SHIFT)
639 #define CV_IS_SUBMAT(flags) ((flags) & CV_MAT_SUBMAT_FLAG)
640 
641 #define CV_MAGIC_MASK 0xFFFF0000
642 #define CV_MAT_MAGIC_VAL 0x42420000
643 #define CV_TYPE_NAME_MAT "opencv-matrix"
644 
645 typedef struct CvMat
646 {
647  int type;
648  int step;
649 
650  /* for internal use only */
651  int* refcount;
653 
654  union
655  {
657  short* s;
658  int* i;
659  float* fl;
660  double* db;
661  } data;
662 
663 #ifdef __cplusplus
664  union
665  {
666  int rows;
667  int height;
668  };
669 
670  union
671  {
672  int cols;
673  int width;
674  };
675 #else
676  int rows;
677  int cols;
678 #endif
679 
680 }
681 CvMat;
682 
683 
684 #define CV_IS_MAT_HDR(mat) \
685  ((mat) != NULL && \
686  (((const CvMat*)(mat))->type & CV_MAGIC_MASK) == CV_MAT_MAGIC_VAL && \
687  ((const CvMat*)(mat))->cols > 0 && ((const CvMat*)(mat))->rows > 0)
688 
689 #define CV_IS_MAT_HDR_Z(mat) \
690  ((mat) != NULL && \
691  (((const CvMat*)(mat))->type & CV_MAGIC_MASK) == CV_MAT_MAGIC_VAL && \
692  ((const CvMat*)(mat))->cols >= 0 && ((const CvMat*)(mat))->rows >= 0)
693 
694 #define CV_IS_MAT(mat) \
695  (CV_IS_MAT_HDR(mat) && ((const CvMat*)(mat))->data.ptr != NULL)
696 
697 #define CV_IS_MASK_ARR(mat) \
698  (((mat)->type & (CV_MAT_TYPE_MASK & ~CV_8SC1)) == 0)
699 
700 #define CV_ARE_TYPES_EQ(mat1, mat2) \
701  ((((mat1)->type ^ (mat2)->type) & CV_MAT_TYPE_MASK) == 0)
702 
703 #define CV_ARE_CNS_EQ(mat1, mat2) \
704  ((((mat1)->type ^ (mat2)->type) & CV_MAT_CN_MASK) == 0)
705 
706 #define CV_ARE_DEPTHS_EQ(mat1, mat2) \
707  ((((mat1)->type ^ (mat2)->type) & CV_MAT_DEPTH_MASK) == 0)
708 
709 #define CV_ARE_SIZES_EQ(mat1, mat2) \
710  ((mat1)->rows == (mat2)->rows && (mat1)->cols == (mat2)->cols)
711 
712 #define CV_IS_MAT_CONST(mat) \
713  (((mat)->rows|(mat)->cols) == 1)
714 
715 /* Size of each channel item,
716  0x124489 = 1000 0100 0100 0010 0010 0001 0001 ~ array of sizeof(arr_type_elem) */
717 #define CV_ELEM_SIZE1(type) \
718  ((((sizeof(size_t)<<28)|0x8442211) >> CV_MAT_DEPTH(type)*4) & 15)
719 
720 /* 0x3a50 = 11 10 10 01 01 00 00 ~ array of log2(sizeof(arr_type_elem)) */
721 #define CV_ELEM_SIZE(type) \
722  (CV_MAT_CN(type) << ((((sizeof(size_t)/4+1)*16384|0x3a50) >> CV_MAT_DEPTH(type)*2) & 3))
723 
724 #define IPL2CV_DEPTH(depth) \
725  ((((CV_8U)+(CV_16U<<4)+(CV_32F<<8)+(CV_64F<<16)+(CV_8S<<20)+ \
726  (CV_16S<<24)+(CV_32S<<28)) >> ((((depth) & 0xF0) >> 2) + \
727  (((depth) & IPL_DEPTH_SIGN) ? 20 : 0))) & 15)
728 
729 /* Inline constructor. No data is allocated internally!!!
730  * (Use together with cvCreateData, or use cvCreateMat instead to
731  * get a matrix with allocated data):
732  */
733 CV_INLINE CvMat cvMat( int rows, int cols, int type, void* data CV_DEFAULT(NULL))
734 {
735  CvMat m;
736 
737  assert( (unsigned)CV_MAT_DEPTH(type) <= CV_64F );
738  type = CV_MAT_TYPE(type);
739  m.type = CV_MAT_MAGIC_VAL | CV_MAT_CONT_FLAG | type;
740  m.cols = cols;
741  m.rows = rows;
742  m.step = m.cols*CV_ELEM_SIZE(type);
743  m.data.ptr = (uchar*)data;
744  m.refcount = NULL;
745  m.hdr_refcount = 0;
746 
747  return m;
748 }
749 
750 
751 #define CV_MAT_ELEM_PTR_FAST( mat, row, col, pix_size ) \
752  (assert( (unsigned)(row) < (unsigned)(mat).rows && \
753  (unsigned)(col) < (unsigned)(mat).cols ), \
754  (mat).data.ptr + (size_t)(mat).step*(row) + (pix_size)*(col))
755 
756 #define CV_MAT_ELEM_PTR( mat, row, col ) \
757  CV_MAT_ELEM_PTR_FAST( mat, row, col, CV_ELEM_SIZE((mat).type) )
758 
759 #define CV_MAT_ELEM( mat, elemtype, row, col ) \
760  (*(elemtype*)CV_MAT_ELEM_PTR_FAST( mat, row, col, sizeof(elemtype)))
761 
762 
763 CV_INLINE double cvmGet( const CvMat* mat, int row, int col )
764 {
765  int type;
766 
767  type = CV_MAT_TYPE(mat->type);
768  assert( (unsigned)row < (unsigned)mat->rows &&
769  (unsigned)col < (unsigned)mat->cols );
770 
771  if( type == CV_32FC1 )
772  return ((float*)(void*)(mat->data.ptr + (size_t)mat->step*row))[col];
773  else
774  {
775  assert( type == CV_64FC1 );
776  return ((double*)(void*)(mat->data.ptr + (size_t)mat->step*row))[col];
777  }
778 }
779 
780 
781 CV_INLINE void cvmSet( CvMat* mat, int row, int col, double value )
782 {
783  int type;
784  type = CV_MAT_TYPE(mat->type);
785  assert( (unsigned)row < (unsigned)mat->rows &&
786  (unsigned)col < (unsigned)mat->cols );
787 
788  if( type == CV_32FC1 )
789  ((float*)(void*)(mat->data.ptr + (size_t)mat->step*row))[col] = (float)value;
790  else
791  {
792  assert( type == CV_64FC1 );
793  ((double*)(void*)(mat->data.ptr + (size_t)mat->step*row))[col] = (double)value;
794  }
795 }
796 
797 
798 CV_INLINE int cvIplDepth( int type )
799 {
800  int depth = CV_MAT_DEPTH(type);
801  return CV_ELEM_SIZE1(depth)*8 | (depth == CV_8S || depth == CV_16S ||
802  depth == CV_32S ? IPL_DEPTH_SIGN : 0);
803 }
804 
805 
806 /****************************************************************************************\
807 * Multi-dimensional dense array (CvMatND) *
808 \****************************************************************************************/
809 
810 #define CV_MATND_MAGIC_VAL 0x42430000
811 #define CV_TYPE_NAME_MATND "opencv-nd-matrix"
812 
813 #define CV_MAX_DIM 32
814 #define CV_MAX_DIM_HEAP 1024
815 
816 typedef struct CvMatND
817 {
818  int type;
819  int dims;
820 
821  int* refcount;
823 
824  union
825  {
827  float* fl;
828  double* db;
829  int* i;
830  short* s;
831  } data;
832 
833  struct
834  {
835  int size;
836  int step;
837  }
838  dim[CV_MAX_DIM];
839 }
840 CvMatND;
841 
842 #define CV_IS_MATND_HDR(mat) \
843  ((mat) != NULL && (((const CvMatND*)(mat))->type & CV_MAGIC_MASK) == CV_MATND_MAGIC_VAL)
844 
845 #define CV_IS_MATND(mat) \
846  (CV_IS_MATND_HDR(mat) && ((const CvMatND*)(mat))->data.ptr != NULL)
847 
848 
849 /****************************************************************************************\
850 * Multi-dimensional sparse array (CvSparseMat) *
851 \****************************************************************************************/
852 
853 #define CV_SPARSE_MAT_MAGIC_VAL 0x42440000
854 #define CV_TYPE_NAME_SPARSE_MAT "opencv-sparse-matrix"
855 
856 struct CvSet;
857 
858 typedef struct CvSparseMat
859 {
860  int type;
861  int dims;
862  int* refcount;
864 
865  struct CvSet* heap;
866  void** hashtable;
867  int hashsize;
870  int size[CV_MAX_DIM];
871 }
873 
874 #define CV_IS_SPARSE_MAT_HDR(mat) \
875  ((mat) != NULL && \
876  (((const CvSparseMat*)(mat))->type & CV_MAGIC_MASK) == CV_SPARSE_MAT_MAGIC_VAL)
877 
878 #define CV_IS_SPARSE_MAT(mat) \
879  CV_IS_SPARSE_MAT_HDR(mat)
880 
881 /**************** iteration through a sparse array *****************/
882 
883 typedef struct CvSparseNode
884 {
885  unsigned hashval;
887 }
889 
890 typedef struct CvSparseMatIterator
891 {
894  int curidx;
895 }
897 
898 #define CV_NODE_VAL(mat,node) ((void*)((uchar*)(node) + (mat)->valoffset))
899 #define CV_NODE_IDX(mat,node) ((int*)((uchar*)(node) + (mat)->idxoffset))
900 
901 /****************************************************************************************\
902 * Histogram *
903 \****************************************************************************************/
904 
905 typedef int CvHistType;
906 
907 #define CV_HIST_MAGIC_VAL 0x42450000
908 #define CV_HIST_UNIFORM_FLAG (1 << 10)
909 
910 /* indicates whether bin ranges are set already or not */
911 #define CV_HIST_RANGES_FLAG (1 << 11)
912 
913 #define CV_HIST_ARRAY 0
914 #define CV_HIST_SPARSE 1
915 #define CV_HIST_TREE CV_HIST_SPARSE
916 
917 /* should be used as a parameter only,
918  it turns to CV_HIST_UNIFORM_FLAG of hist->type */
919 #define CV_HIST_UNIFORM 1
920 
921 typedef struct CvHistogram
922 {
923  int type;
925  float thresh[CV_MAX_DIM][2]; /* For uniform histograms. */
926  float** thresh2; /* For non-uniform histograms. */
927  CvMatND mat; /* Embedded matrix header for array histograms. */
928 }
930 
931 #define CV_IS_HIST( hist ) \
932  ((hist) != NULL && \
933  (((CvHistogram*)(hist))->type & CV_MAGIC_MASK) == CV_HIST_MAGIC_VAL && \
934  (hist)->bins != NULL)
935 
936 #define CV_IS_UNIFORM_HIST( hist ) \
937  (((hist)->type & CV_HIST_UNIFORM_FLAG) != 0)
938 
939 #define CV_IS_SPARSE_HIST( hist ) \
940  CV_IS_SPARSE_MAT((hist)->bins)
941 
942 #define CV_HIST_HAS_RANGES( hist ) \
943  (((hist)->type & CV_HIST_RANGES_FLAG) != 0)
944 
945 /****************************************************************************************\
946 * Other supplementary data type definitions *
947 \****************************************************************************************/
948 
949 /*************************************** CvRect *****************************************/
950 
951 typedef struct CvRect
952 {
953  int x;
954  int y;
955  int width;
956  int height;
957 }
958 CvRect;
959 
960 CV_INLINE CvRect cvRect( int x, int y, int width, int height )
961 {
962  CvRect r;
963 
964  r.x = x;
965  r.y = y;
966  r.width = width;
967  r.height = height;
968 
969  return r;
970 }
971 
972 
973 CV_INLINE IplROI cvRectToROI( CvRect rect, int coi )
974 {
975  IplROI roi;
976  roi.xOffset = rect.x;
977  roi.yOffset = rect.y;
978  roi.width = rect.width;
979  roi.height = rect.height;
980  roi.coi = coi;
981 
982  return roi;
983 }
984 
985 
987 {
988  return cvRect( roi.xOffset, roi.yOffset, roi.width, roi.height );
989 }
990 
991 /*********************************** CvTermCriteria *************************************/
992 
993 #define CV_TERMCRIT_ITER 1
994 #define CV_TERMCRIT_NUMBER CV_TERMCRIT_ITER
995 #define CV_TERMCRIT_EPS 2
996 
997 typedef struct CvTermCriteria
998 {
999  int type; /* may be combination of
1000  CV_TERMCRIT_ITER
1001  CV_TERMCRIT_EPS */
1003  double epsilon;
1004 }
1006 
1007 CV_INLINE CvTermCriteria cvTermCriteria( int type, int max_iter, double epsilon )
1008 {
1009  CvTermCriteria t;
1010 
1011  t.type = type;
1012  t.max_iter = max_iter;
1013  t.epsilon = (float)epsilon;
1014 
1015  return t;
1016 }
1017 
1018 
1019 /******************************* CvPoint and variants ***********************************/
1020 
1021 typedef struct CvPoint
1022 {
1023  int x;
1024  int y;
1025 }
1026 CvPoint;
1027 
1028 
1029 CV_INLINE CvPoint cvPoint( int x, int y )
1030 {
1031  CvPoint p;
1032 
1033  p.x = x;
1034  p.y = y;
1035 
1036  return p;
1037 }
1038 
1039 
1040 typedef struct CvPoint2D32f
1041 {
1042  float x;
1043  float y;
1044 }
1045 CvPoint2D32f;
1046 
1047 
1048 CV_INLINE CvPoint2D32f cvPoint2D32f( double x, double y )
1049 {
1050  CvPoint2D32f p;
1051 
1052  p.x = (float)x;
1053  p.y = (float)y;
1054 
1055  return p;
1056 }
1057 
1058 
1060 {
1061  return cvPoint2D32f( (float)point.x, (float)point.y );
1062 }
1063 
1064 
1066 {
1067  CvPoint ipt;
1068  ipt.x = cvRound(point.x);
1069  ipt.y = cvRound(point.y);
1070 
1071  return ipt;
1072 }
1073 
1074 
1075 typedef struct CvPoint3D32f
1076 {
1077  float x;
1078  float y;
1079  float z;
1080 }
1081 CvPoint3D32f;
1082 
1083 
1084 CV_INLINE CvPoint3D32f cvPoint3D32f( double x, double y, double z )
1085 {
1086  CvPoint3D32f p;
1087 
1088  p.x = (float)x;
1089  p.y = (float)y;
1090  p.z = (float)z;
1091 
1092  return p;
1093 }
1094 
1095 
1096 typedef struct CvPoint2D64f
1097 {
1098  double x;
1099  double y;
1100 }
1101 CvPoint2D64f;
1102 
1103 
1104 CV_INLINE CvPoint2D64f cvPoint2D64f( double x, double y )
1105 {
1106  CvPoint2D64f p;
1107 
1108  p.x = x;
1109  p.y = y;
1110 
1111  return p;
1112 }
1113 
1114 
1115 typedef struct CvPoint3D64f
1116 {
1117  double x;
1118  double y;
1119  double z;
1120 }
1121 CvPoint3D64f;
1122 
1123 
1124 CV_INLINE CvPoint3D64f cvPoint3D64f( double x, double y, double z )
1125 {
1126  CvPoint3D64f p;
1127 
1128  p.x = x;
1129  p.y = y;
1130  p.z = z;
1131 
1132  return p;
1133 }
1134 
1135 
1136 /******************************** CvSize's & CvBox **************************************/
1137 
1138 typedef struct CvSize
1139 {
1140  int width;
1141  int height;
1142 }
1143 CvSize;
1144 
1145 CV_INLINE CvSize cvSize( int width, int height )
1146 {
1147  CvSize s;
1148 
1149  s.width = width;
1150  s.height = height;
1151 
1152  return s;
1153 }
1154 
1155 typedef struct CvSize2D32f
1156 {
1157  float width;
1158  float height;
1159 }
1160 CvSize2D32f;
1161 
1162 
1163 CV_INLINE CvSize2D32f cvSize2D32f( double width, double height )
1164 {
1165  CvSize2D32f s;
1166 
1167  s.width = (float)width;
1168  s.height = (float)height;
1169 
1170  return s;
1171 }
1172 
1173 typedef struct CvBox2D
1174 {
1175  CvPoint2D32f center; /* Center of the box. */
1176  CvSize2D32f size; /* Box width and length. */
1177  float angle; /* Angle between the horizontal axis */
1178  /* and the first side (i.e. length) in degrees */
1179 }
1180 CvBox2D;
1181 
1182 
1183 /* Line iterator state: */
1184 typedef struct CvLineIterator
1185 {
1186  /* Pointer to the current point: */
1188 
1189  /* Bresenham algorithm state: */
1190  int err;
1195 }
1197 
1198 
1199 
1200 /************************************* CvSlice ******************************************/
1201 
1202 typedef struct CvSlice
1203 {
1205 }
1206 CvSlice;
1207 
1208 CV_INLINE CvSlice cvSlice( int start, int end )
1209 {
1210  CvSlice slice;
1211  slice.start_index = start;
1212  slice.end_index = end;
1213 
1214  return slice;
1215 }
1216 
1217 #define CV_WHOLE_SEQ_END_INDEX 0x3fffffff
1218 #define CV_WHOLE_SEQ cvSlice(0, CV_WHOLE_SEQ_END_INDEX)
1219 
1220 
1221 /************************************* CvScalar *****************************************/
1222 
1223 typedef struct CvScalar
1224 {
1225  double val[4];
1226 }
1227 CvScalar;
1228 
1229 CV_INLINE CvScalar cvScalar( double val0, double val1 CV_DEFAULT(0),
1230  double val2 CV_DEFAULT(0), double val3 CV_DEFAULT(0))
1231 {
1232  CvScalar scalar;
1233  scalar.val[0] = val0; scalar.val[1] = val1;
1234  scalar.val[2] = val2; scalar.val[3] = val3;
1235  return scalar;
1236 }
1237 
1238 
1239 CV_INLINE CvScalar cvRealScalar( double val0 )
1240 {
1241  CvScalar scalar;
1242  scalar.val[0] = val0;
1243  scalar.val[1] = scalar.val[2] = scalar.val[3] = 0;
1244  return scalar;
1245 }
1246 
1247 CV_INLINE CvScalar cvScalarAll( double val0123 )
1248 {
1249  CvScalar scalar;
1250  scalar.val[0] = val0123;
1251  scalar.val[1] = val0123;
1252  scalar.val[2] = val0123;
1253  scalar.val[3] = val0123;
1254  return scalar;
1255 }
1256 
1257 /****************************************************************************************\
1258 * Dynamic Data structures *
1259 \****************************************************************************************/
1260 
1261 /******************************** Memory storage ****************************************/
1262 
1263 typedef struct CvMemBlock
1264 {
1265  struct CvMemBlock* prev;
1266  struct CvMemBlock* next;
1267 }
1268 CvMemBlock;
1269 
1270 #define CV_STORAGE_MAGIC_VAL 0x42890000
1271 
1272 typedef struct CvMemStorage
1273 {
1275  CvMemBlock* bottom; /* First allocated block. */
1276  CvMemBlock* top; /* Current memory block - top of the stack. */
1277  struct CvMemStorage* parent; /* We get new blocks from parent as needed. */
1278  int block_size; /* Block size. */
1279  int free_space; /* Remaining free space in current block. */
1280 }
1281 CvMemStorage;
1282 
1283 #define CV_IS_STORAGE(storage) \
1284  ((storage) != NULL && \
1285  (((CvMemStorage*)(storage))->signature & CV_MAGIC_MASK) == CV_STORAGE_MAGIC_VAL)
1286 
1287 
1288 typedef struct CvMemStoragePos
1289 {
1292 }
1294 
1295 
1296 /*********************************** Sequence *******************************************/
1297 
1298 typedef struct CvSeqBlock
1299 {
1300  struct CvSeqBlock* prev; /* Previous sequence block. */
1301  struct CvSeqBlock* next; /* Next sequence block. */
1302  int start_index; /* Index of the first element in the block + */
1303  /* sequence->first->start_index. */
1304  int count; /* Number of elements in the block. */
1305  schar* data; /* Pointer to the first element of the block. */
1306 }
1307 CvSeqBlock;
1308 
1309 
1310 #define CV_TREE_NODE_FIELDS(node_type) \
1311  int flags; /* Miscellaneous flags. */ \
1312  int header_size; /* Size of sequence header. */ \
1313  struct node_type* h_prev; /* Previous sequence. */ \
1314  struct node_type* h_next; /* Next sequence. */ \
1315  struct node_type* v_prev; /* 2nd previous sequence. */ \
1316  struct node_type* v_next /* 2nd next sequence. */
1317 
1318 /*
1319  Read/Write sequence.
1320  Elements can be dynamically inserted to or deleted from the sequence.
1321 */
1322 #define CV_SEQUENCE_FIELDS() \
1323  CV_TREE_NODE_FIELDS(CvSeq); \
1324  int total; /* Total number of elements. */ \
1325  int elem_size; /* Size of sequence element in bytes. */ \
1326  schar* block_max; /* Maximal bound of the last block. */ \
1327  schar* ptr; /* Current write pointer. */ \
1328  int delta_elems; /* Grow seq this many at a time. */ \
1329  CvMemStorage* storage; /* Where the seq is stored. */ \
1330  CvSeqBlock* free_blocks; /* Free blocks list. */ \
1331  CvSeqBlock* first; /* Pointer to the first sequence block. */
1332 
1333 typedef struct CvSeq
1334 {
1335  CV_SEQUENCE_FIELDS()
1336 }
1337 CvSeq;
1338 
1339 #define CV_TYPE_NAME_SEQ "opencv-sequence"
1340 #define CV_TYPE_NAME_SEQ_TREE "opencv-sequence-tree"
1341 
1342 /*************************************** Set ********************************************/
1343 /*
1344  Set.
1345  Order is not preserved. There can be gaps between sequence elements.
1346  After the element has been inserted it stays in the same place all the time.
1347  The MSB(most-significant or sign bit) of the first field (flags) is 0 iff the element exists.
1348 */
1349 #define CV_SET_ELEM_FIELDS(elem_type) \
1350  int flags; \
1351  struct elem_type* next_free;
1352 
1353 typedef struct CvSetElem
1354 {
1355  CV_SET_ELEM_FIELDS(CvSetElem)
1356 }
1357 CvSetElem;
1358 
1359 #define CV_SET_FIELDS() \
1360  CV_SEQUENCE_FIELDS() \
1361  CvSetElem* free_elems; \
1362  int active_count;
1363 
1364 typedef struct CvSet
1365 {
1366  CV_SET_FIELDS()
1367 }
1368 CvSet;
1369 
1370 
1371 #define CV_SET_ELEM_IDX_MASK ((1 << 26) - 1)
1372 #define CV_SET_ELEM_FREE_FLAG (1 << (sizeof(int)*8-1))
1373 
1374 /* Checks whether the element pointed by ptr belongs to a set or not */
1375 #define CV_IS_SET_ELEM( ptr ) (((CvSetElem*)(ptr))->flags >= 0)
1376 
1377 /************************************* Graph ********************************************/
1378 
1379 /*
1380  We represent a graph as a set of vertices.
1381  Vertices contain their adjacency lists (more exactly, pointers to first incoming or
1382  outcoming edge (or 0 if isolated vertex)). Edges are stored in another set.
1383  There is a singly-linked list of incoming/outcoming edges for each vertex.
1384 
1385  Each edge consists of
1386 
1387  o Two pointers to the starting and ending vertices
1388  (vtx[0] and vtx[1] respectively).
1389 
1390  A graph may be oriented or not. In the latter case, edges between
1391  vertex i to vertex j are not distinguished during search operations.
1392 
1393  o Two pointers to next edges for the starting and ending vertices, where
1394  next[0] points to the next edge in the vtx[0] adjacency list and
1395  next[1] points to the next edge in the vtx[1] adjacency list.
1396 */
1397 #define CV_GRAPH_EDGE_FIELDS() \
1398  int flags; \
1399  float weight; \
1400  struct CvGraphEdge* next[2]; \
1401  struct CvGraphVtx* vtx[2];
1402 
1403 
1404 #define CV_GRAPH_VERTEX_FIELDS() \
1405  int flags; \
1406  struct CvGraphEdge* first;
1407 
1408 
1409 typedef struct CvGraphEdge
1410 {
1411  CV_GRAPH_EDGE_FIELDS()
1412 }
1413 CvGraphEdge;
1414 
1415 typedef struct CvGraphVtx
1416 {
1417  CV_GRAPH_VERTEX_FIELDS()
1418 }
1419 CvGraphVtx;
1420 
1421 typedef struct CvGraphVtx2D
1422 {
1424  CvPoint2D32f* ptr;
1425 }
1426 CvGraphVtx2D;
1427 
1428 /*
1429  Graph is "derived" from the set (this is set a of vertices)
1430  and includes another set (edges)
1431 */
1432 #define CV_GRAPH_FIELDS() \
1433  CV_SET_FIELDS() \
1434  CvSet* edges;
1435 
1436 typedef struct CvGraph
1437 {
1438  CV_GRAPH_FIELDS()
1439 }
1440 CvGraph;
1441 
1442 #define CV_TYPE_NAME_GRAPH "opencv-graph"
1443 
1444 /*********************************** Chain/Countour *************************************/
1445 
1446 typedef struct CvChain
1447 {
1449  CvPoint origin;
1450 }
1451 CvChain;
1452 
1453 #define CV_CONTOUR_FIELDS() \
1454  CV_SEQUENCE_FIELDS() \
1455  CvRect rect; \
1456  int color; \
1457  int reserved[3];
1458 
1459 typedef struct CvContour
1460 {
1461  CV_CONTOUR_FIELDS()
1462 }
1463 CvContour;
1464 
1466 
1467 /****************************************************************************************\
1468 * Sequence types *
1469 \****************************************************************************************/
1470 
1471 #define CV_SEQ_MAGIC_VAL 0x42990000
1472 
1473 #define CV_IS_SEQ(seq) \
1474  ((seq) != NULL && (((CvSeq*)(seq))->flags & CV_MAGIC_MASK) == CV_SEQ_MAGIC_VAL)
1475 
1476 #define CV_SET_MAGIC_VAL 0x42980000
1477 #define CV_IS_SET(set) \
1478  ((set) != NULL && (((CvSeq*)(set))->flags & CV_MAGIC_MASK) == CV_SET_MAGIC_VAL)
1479 
1480 #define CV_SEQ_ELTYPE_BITS 12
1481 #define CV_SEQ_ELTYPE_MASK ((1 << CV_SEQ_ELTYPE_BITS) - 1)
1482 
1483 #define CV_SEQ_ELTYPE_POINT CV_32SC2 /* (x,y) */
1484 #define CV_SEQ_ELTYPE_CODE CV_8UC1 /* freeman code: 0..7 */
1485 #define CV_SEQ_ELTYPE_GENERIC 0
1486 #define CV_SEQ_ELTYPE_PTR CV_USRTYPE1
1487 #define CV_SEQ_ELTYPE_PPOINT CV_SEQ_ELTYPE_PTR /* &(x,y) */
1488 #define CV_SEQ_ELTYPE_INDEX CV_32SC1 /* #(x,y) */
1489 #define CV_SEQ_ELTYPE_GRAPH_EDGE 0 /* &next_o, &next_d, &vtx_o, &vtx_d */
1490 #define CV_SEQ_ELTYPE_GRAPH_VERTEX 0 /* first_edge, &(x,y) */
1491 #define CV_SEQ_ELTYPE_TRIAN_ATR 0 /* vertex of the binary tree */
1492 #define CV_SEQ_ELTYPE_CONNECTED_COMP 0 /* connected component */
1493 #define CV_SEQ_ELTYPE_POINT3D CV_32FC3 /* (x,y,z) */
1494 
1495 #define CV_SEQ_KIND_BITS 2
1496 #define CV_SEQ_KIND_MASK (((1 << CV_SEQ_KIND_BITS) - 1)<<CV_SEQ_ELTYPE_BITS)
1497 
1498 /* types of sequences */
1499 #define CV_SEQ_KIND_GENERIC (0 << CV_SEQ_ELTYPE_BITS)
1500 #define CV_SEQ_KIND_CURVE (1 << CV_SEQ_ELTYPE_BITS)
1501 #define CV_SEQ_KIND_BIN_TREE (2 << CV_SEQ_ELTYPE_BITS)
1502 
1503 /* types of sparse sequences (sets) */
1504 #define CV_SEQ_KIND_GRAPH (1 << CV_SEQ_ELTYPE_BITS)
1505 #define CV_SEQ_KIND_SUBDIV2D (2 << CV_SEQ_ELTYPE_BITS)
1506 
1507 #define CV_SEQ_FLAG_SHIFT (CV_SEQ_KIND_BITS + CV_SEQ_ELTYPE_BITS)
1508 
1509 /* flags for curves */
1510 #define CV_SEQ_FLAG_CLOSED (1 << CV_SEQ_FLAG_SHIFT)
1511 #define CV_SEQ_FLAG_SIMPLE (0 << CV_SEQ_FLAG_SHIFT)
1512 #define CV_SEQ_FLAG_CONVEX (0 << CV_SEQ_FLAG_SHIFT)
1513 #define CV_SEQ_FLAG_HOLE (2 << CV_SEQ_FLAG_SHIFT)
1514 
1515 /* flags for graphs */
1516 #define CV_GRAPH_FLAG_ORIENTED (1 << CV_SEQ_FLAG_SHIFT)
1517 
1518 #define CV_GRAPH CV_SEQ_KIND_GRAPH
1519 #define CV_ORIENTED_GRAPH (CV_SEQ_KIND_GRAPH|CV_GRAPH_FLAG_ORIENTED)
1520 
1521 /* point sets */
1522 #define CV_SEQ_POINT_SET (CV_SEQ_KIND_GENERIC| CV_SEQ_ELTYPE_POINT)
1523 #define CV_SEQ_POINT3D_SET (CV_SEQ_KIND_GENERIC| CV_SEQ_ELTYPE_POINT3D)
1524 #define CV_SEQ_POLYLINE (CV_SEQ_KIND_CURVE | CV_SEQ_ELTYPE_POINT)
1525 #define CV_SEQ_POLYGON (CV_SEQ_FLAG_CLOSED | CV_SEQ_POLYLINE )
1526 #define CV_SEQ_CONTOUR CV_SEQ_POLYGON
1527 #define CV_SEQ_SIMPLE_POLYGON (CV_SEQ_FLAG_SIMPLE | CV_SEQ_POLYGON )
1528 
1529 /* chain-coded curves */
1530 #define CV_SEQ_CHAIN (CV_SEQ_KIND_CURVE | CV_SEQ_ELTYPE_CODE)
1531 #define CV_SEQ_CHAIN_CONTOUR (CV_SEQ_FLAG_CLOSED | CV_SEQ_CHAIN)
1532 
1533 /* binary tree for the contour */
1534 #define CV_SEQ_POLYGON_TREE (CV_SEQ_KIND_BIN_TREE | CV_SEQ_ELTYPE_TRIAN_ATR)
1535 
1536 /* sequence of the connected components */
1537 #define CV_SEQ_CONNECTED_COMP (CV_SEQ_KIND_GENERIC | CV_SEQ_ELTYPE_CONNECTED_COMP)
1538 
1539 /* sequence of the integer numbers */
1540 #define CV_SEQ_INDEX (CV_SEQ_KIND_GENERIC | CV_SEQ_ELTYPE_INDEX)
1541 
1542 #define CV_SEQ_ELTYPE( seq ) ((seq)->flags & CV_SEQ_ELTYPE_MASK)
1543 #define CV_SEQ_KIND( seq ) ((seq)->flags & CV_SEQ_KIND_MASK )
1544 
1545 /* flag checking */
1546 #define CV_IS_SEQ_INDEX( seq ) ((CV_SEQ_ELTYPE(seq) == CV_SEQ_ELTYPE_INDEX) && \
1547  (CV_SEQ_KIND(seq) == CV_SEQ_KIND_GENERIC))
1548 
1549 #define CV_IS_SEQ_CURVE( seq ) (CV_SEQ_KIND(seq) == CV_SEQ_KIND_CURVE)
1550 #define CV_IS_SEQ_CLOSED( seq ) (((seq)->flags & CV_SEQ_FLAG_CLOSED) != 0)
1551 #define CV_IS_SEQ_CONVEX( seq ) 0
1552 #define CV_IS_SEQ_HOLE( seq ) (((seq)->flags & CV_SEQ_FLAG_HOLE) != 0)
1553 #define CV_IS_SEQ_SIMPLE( seq ) 1
1554 
1555 /* type checking macros */
1556 #define CV_IS_SEQ_POINT_SET( seq ) \
1557  ((CV_SEQ_ELTYPE(seq) == CV_32SC2 || CV_SEQ_ELTYPE(seq) == CV_32FC2))
1558 
1559 #define CV_IS_SEQ_POINT_SUBSET( seq ) \
1560  (CV_IS_SEQ_INDEX( seq ) || CV_SEQ_ELTYPE(seq) == CV_SEQ_ELTYPE_PPOINT)
1561 
1562 #define CV_IS_SEQ_POLYLINE( seq ) \
1563  (CV_SEQ_KIND(seq) == CV_SEQ_KIND_CURVE && CV_IS_SEQ_POINT_SET(seq))
1564 
1565 #define CV_IS_SEQ_POLYGON( seq ) \
1566  (CV_IS_SEQ_POLYLINE(seq) && CV_IS_SEQ_CLOSED(seq))
1567 
1568 #define CV_IS_SEQ_CHAIN( seq ) \
1569  (CV_SEQ_KIND(seq) == CV_SEQ_KIND_CURVE && (seq)->elem_size == 1)
1570 
1571 #define CV_IS_SEQ_CONTOUR( seq ) \
1572  (CV_IS_SEQ_CLOSED(seq) && (CV_IS_SEQ_POLYLINE(seq) || CV_IS_SEQ_CHAIN(seq)))
1573 
1574 #define CV_IS_SEQ_CHAIN_CONTOUR( seq ) \
1575  (CV_IS_SEQ_CHAIN( seq ) && CV_IS_SEQ_CLOSED( seq ))
1576 
1577 #define CV_IS_SEQ_POLYGON_TREE( seq ) \
1578  (CV_SEQ_ELTYPE (seq) == CV_SEQ_ELTYPE_TRIAN_ATR && \
1579  CV_SEQ_KIND( seq ) == CV_SEQ_KIND_BIN_TREE )
1580 
1581 #define CV_IS_GRAPH( seq ) \
1582  (CV_IS_SET(seq) && CV_SEQ_KIND((CvSet*)(seq)) == CV_SEQ_KIND_GRAPH)
1583 
1584 #define CV_IS_GRAPH_ORIENTED( seq ) \
1585  (((seq)->flags & CV_GRAPH_FLAG_ORIENTED) != 0)
1586 
1587 #define CV_IS_SUBDIV2D( seq ) \
1588  (CV_IS_SET(seq) && CV_SEQ_KIND((CvSet*)(seq)) == CV_SEQ_KIND_SUBDIV2D)
1589 
1590 /****************************************************************************************/
1591 /* Sequence writer & reader */
1592 /****************************************************************************************/
1593 
1594 #define CV_SEQ_WRITER_FIELDS() \
1595  int header_size; \
1596  CvSeq* seq; /* the sequence written */ \
1597  CvSeqBlock* block; /* current block */ \
1598  schar* ptr; /* pointer to free space */ \
1599  schar* block_min; /* pointer to the beginning of block*/\
1600  schar* block_max; /* pointer to the end of block */
1601 
1602 typedef struct CvSeqWriter
1603 {
1604  CV_SEQ_WRITER_FIELDS()
1605 }
1606 CvSeqWriter;
1607 
1608 
1609 #define CV_SEQ_READER_FIELDS() \
1610  int header_size; \
1611  CvSeq* seq; /* sequence, beign read */ \
1612  CvSeqBlock* block; /* current block */ \
1613  schar* ptr; /* pointer to element be read next */ \
1614  schar* block_min; /* pointer to the beginning of block */\
1615  schar* block_max; /* pointer to the end of block */ \
1616  int delta_index;/* = seq->first->start_index */ \
1617  schar* prev_elem; /* pointer to previous element */
1618 
1619 
1620 typedef struct CvSeqReader
1621 {
1622  CV_SEQ_READER_FIELDS()
1623 }
1624 CvSeqReader;
1625 
1626 /****************************************************************************************/
1627 /* Operations on sequences */
1628 /****************************************************************************************/
1629 
1630 #define CV_SEQ_ELEM( seq, elem_type, index ) \
1631 /* assert gives some guarantee that <seq> parameter is valid */ \
1632 ( assert(sizeof((seq)->first[0]) == sizeof(CvSeqBlock) && \
1633  (seq)->elem_size == sizeof(elem_type)), \
1634  (elem_type*)((seq)->first && (unsigned)index < \
1635  (unsigned)((seq)->first->count) ? \
1636  (seq)->first->data + (index) * sizeof(elem_type) : \
1637  cvGetSeqElem( (CvSeq*)(seq), (index) )))
1638 #define CV_GET_SEQ_ELEM( elem_type, seq, index ) CV_SEQ_ELEM( (seq), elem_type, (index) )
1639 
1640 /* Add element to sequence: */
1641 #define CV_WRITE_SEQ_ELEM_VAR( elem_ptr, writer ) \
1642 { \
1643  if( (writer).ptr >= (writer).block_max ) \
1644  { \
1645  cvCreateSeqBlock( &writer); \
1646  } \
1647  memcpy((writer).ptr, elem_ptr, (writer).seq->elem_size);\
1648  (writer).ptr += (writer).seq->elem_size; \
1649 }
1650 
1651 #define CV_WRITE_SEQ_ELEM( elem, writer ) \
1652 { \
1653  assert( (writer).seq->elem_size == sizeof(elem)); \
1654  if( (writer).ptr >= (writer).block_max ) \
1655  { \
1656  cvCreateSeqBlock( &writer); \
1657  } \
1658  assert( (writer).ptr <= (writer).block_max - sizeof(elem));\
1659  memcpy((writer).ptr, &(elem), sizeof(elem)); \
1660  (writer).ptr += sizeof(elem); \
1661 }
1662 
1663 
1664 /* Move reader position forward: */
1665 #define CV_NEXT_SEQ_ELEM( elem_size, reader ) \
1666 { \
1667  if( ((reader).ptr += (elem_size)) >= (reader).block_max ) \
1668  { \
1669  cvChangeSeqBlock( &(reader), 1 ); \
1670  } \
1671 }
1672 
1673 
1674 /* Move reader position backward: */
1675 #define CV_PREV_SEQ_ELEM( elem_size, reader ) \
1676 { \
1677  if( ((reader).ptr -= (elem_size)) < (reader).block_min ) \
1678  { \
1679  cvChangeSeqBlock( &(reader), -1 ); \
1680  } \
1681 }
1682 
1683 /* Read element and move read position forward: */
1684 #define CV_READ_SEQ_ELEM( elem, reader ) \
1685 { \
1686  assert( (reader).seq->elem_size == sizeof(elem)); \
1687  memcpy( &(elem), (reader).ptr, sizeof((elem))); \
1688  CV_NEXT_SEQ_ELEM( sizeof(elem), reader ) \
1689 }
1690 
1691 /* Read element and move read position backward: */
1692 #define CV_REV_READ_SEQ_ELEM( elem, reader ) \
1693 { \
1694  assert( (reader).seq->elem_size == sizeof(elem)); \
1695  memcpy(&(elem), (reader).ptr, sizeof((elem))); \
1696  CV_PREV_SEQ_ELEM( sizeof(elem), reader ) \
1697 }
1698 
1699 
1700 #define CV_READ_CHAIN_POINT( _pt, reader ) \
1701 { \
1702  (_pt) = (reader).pt; \
1703  if( (reader).ptr ) \
1704  { \
1705  CV_READ_SEQ_ELEM( (reader).code, (reader)); \
1706  assert( ((reader).code & ~7) == 0 ); \
1707  (reader).pt.x += (reader).deltas[(int)(reader).code][0]; \
1708  (reader).pt.y += (reader).deltas[(int)(reader).code][1]; \
1709  } \
1710 }
1711 
1712 #define CV_CURRENT_POINT( reader ) (*((CvPoint*)((reader).ptr)))
1713 #define CV_PREV_POINT( reader ) (*((CvPoint*)((reader).prev_elem)))
1714 
1715 #define CV_READ_EDGE( pt1, pt2, reader ) \
1716 { \
1717  assert( sizeof(pt1) == sizeof(CvPoint) && \
1718  sizeof(pt2) == sizeof(CvPoint) && \
1719  reader.seq->elem_size == sizeof(CvPoint)); \
1720  (pt1) = CV_PREV_POINT( reader ); \
1721  (pt2) = CV_CURRENT_POINT( reader ); \
1722  (reader).prev_elem = (reader).ptr; \
1723  CV_NEXT_SEQ_ELEM( sizeof(CvPoint), (reader)); \
1724 }
1725 
1726 /************ Graph macros ************/
1727 
1728 /* Return next graph edge for given vertex: */
1729 #define CV_NEXT_GRAPH_EDGE( edge, vertex ) \
1730  (assert((edge)->vtx[0] == (vertex) || (edge)->vtx[1] == (vertex)), \
1731  (edge)->next[(edge)->vtx[1] == (vertex)])
1732 
1733 
1734 
1735 /****************************************************************************************\
1736 * Data structures for persistence (a.k.a serialization) functionality *
1737 \****************************************************************************************/
1738 
1739 /* "black box" file storage */
1741 
1742 /* Storage flags: */
1743 #define CV_STORAGE_READ 0
1744 #define CV_STORAGE_WRITE 1
1745 #define CV_STORAGE_WRITE_TEXT CV_STORAGE_WRITE
1746 #define CV_STORAGE_WRITE_BINARY CV_STORAGE_WRITE
1747 #define CV_STORAGE_APPEND 2
1748 #define CV_STORAGE_MEMORY 4
1749 #define CV_STORAGE_FORMAT_MASK (7<<3)
1750 #define CV_STORAGE_FORMAT_AUTO 0
1751 #define CV_STORAGE_FORMAT_XML 8
1752 #define CV_STORAGE_FORMAT_YAML 16
1753 
1754 /* List of attributes: */
1755 typedef struct CvAttrList
1756 {
1757  const char** attr; /* NULL-terminated array of (attribute_name,attribute_value) pairs. */
1758  struct CvAttrList* next; /* Pointer to next chunk of the attributes list. */
1759 }
1760 CvAttrList;
1761 
1762 CV_INLINE CvAttrList cvAttrList( const char** attr CV_DEFAULT(NULL),
1763  CvAttrList* next CV_DEFAULT(NULL) )
1764 {
1765  CvAttrList l;
1766  l.attr = attr;
1767  l.next = next;
1768 
1769  return l;
1770 }
1771 
1772 struct CvTypeInfo;
1773 
1774 #define CV_NODE_NONE 0
1775 #define CV_NODE_INT 1
1776 #define CV_NODE_INTEGER CV_NODE_INT
1777 #define CV_NODE_REAL 2
1778 #define CV_NODE_FLOAT CV_NODE_REAL
1779 #define CV_NODE_STR 3
1780 #define CV_NODE_STRING CV_NODE_STR
1781 #define CV_NODE_REF 4 /* not used */
1782 #define CV_NODE_SEQ 5
1783 #define CV_NODE_MAP 6
1784 #define CV_NODE_TYPE_MASK 7
1785 
1786 #define CV_NODE_TYPE(flags) ((flags) & CV_NODE_TYPE_MASK)
1787 
1788 /* file node flags */
1789 #define CV_NODE_FLOW 8 /* Used only for writing structures in YAML format. */
1790 #define CV_NODE_USER 16
1791 #define CV_NODE_EMPTY 32
1792 #define CV_NODE_NAMED 64
1793 
1794 #define CV_NODE_IS_INT(flags) (CV_NODE_TYPE(flags) == CV_NODE_INT)
1795 #define CV_NODE_IS_REAL(flags) (CV_NODE_TYPE(flags) == CV_NODE_REAL)
1796 #define CV_NODE_IS_STRING(flags) (CV_NODE_TYPE(flags) == CV_NODE_STRING)
1797 #define CV_NODE_IS_SEQ(flags) (CV_NODE_TYPE(flags) == CV_NODE_SEQ)
1798 #define CV_NODE_IS_MAP(flags) (CV_NODE_TYPE(flags) == CV_NODE_MAP)
1799 #define CV_NODE_IS_COLLECTION(flags) (CV_NODE_TYPE(flags) >= CV_NODE_SEQ)
1800 #define CV_NODE_IS_FLOW(flags) (((flags) & CV_NODE_FLOW) != 0)
1801 #define CV_NODE_IS_EMPTY(flags) (((flags) & CV_NODE_EMPTY) != 0)
1802 #define CV_NODE_IS_USER(flags) (((flags) & CV_NODE_USER) != 0)
1803 #define CV_NODE_HAS_NAME(flags) (((flags) & CV_NODE_NAMED) != 0)
1804 
1805 #define CV_NODE_SEQ_SIMPLE 256
1806 #define CV_NODE_SEQ_IS_SIMPLE(seq) (((seq)->flags & CV_NODE_SEQ_SIMPLE) != 0)
1807 
1808 typedef struct CvString
1809 {
1810  int len;
1811  char* ptr;
1812 }
1813 CvString;
1814 
1815 /* All the keys (names) of elements in the readed file storage
1816  are stored in the hash to speed up the lookup operations: */
1817 typedef struct CvStringHashNode
1818 {
1819  unsigned hashval;
1822 }
1824 
1825 typedef struct CvGenericHash CvFileNodeHash;
1826 
1827 /* Basic element of the file storage - scalar or collection: */
1828 typedef struct CvFileNode
1829 {
1830  int tag;
1831  struct CvTypeInfo* info; /* type information
1832  (only for user-defined object, for others it is 0) */
1833  union
1834  {
1835  double f; /* scalar floating-point number */
1836  int i; /* scalar integer number */
1837  CvString str; /* text string */
1838  CvSeq* seq; /* sequence (ordered collection of file nodes) */
1839  CvFileNodeHash* map; /* map (collection of named file nodes) */
1840  } data;
1841 }
1842 CvFileNode;
1843 
1844 #ifdef __cplusplus
1845 extern "C" {
1846 #endif
1847 typedef int (CV_CDECL *CvIsInstanceFunc)( const void* struct_ptr );
1848 typedef void (CV_CDECL *CvReleaseFunc)( void** struct_dblptr );
1849 typedef void* (CV_CDECL *CvReadFunc)( CvFileStorage* storage, CvFileNode* node );
1850 typedef void (CV_CDECL *CvWriteFunc)( CvFileStorage* storage, const char* name,
1851  const void* struct_ptr, CvAttrList attributes );
1852 typedef void* (CV_CDECL *CvCloneFunc)( const void* struct_ptr );
1853 #ifdef __cplusplus
1854 }
1855 #endif
1856 
1857 typedef struct CvTypeInfo
1858 {
1859  int flags;
1861  struct CvTypeInfo* prev;
1862  struct CvTypeInfo* next;
1863  const char* type_name;
1869 }
1870 CvTypeInfo;
1871 
1872 
1873 /**** System data types ******/
1874 
1875 typedef struct CvPluginFuncInfo
1876 {
1877  void** func_addr;
1879  const char* func_names;
1882 }
1884 
1885 typedef struct CvModuleInfo
1886 {
1888  const char* name;
1889  const char* version;
1891 }
1892 CvModuleInfo;
1893 
1894 #endif /*__OPENCV_CORE_TYPES_H__*/
1895 
1896 /* End of file. */
struct CvTermCriteria CvTermCriteria
int height
Definition: types_c.h:482
float height
Definition: types_c.h:1158
Definition: types_c.h:244
int free_space
Definition: types_c.h:1291
int i
Definition: types_c.h:200
int anchorX
Definition: types_c.h:516
double z
Definition: types_c.h:1119
Definition: types_c.h:253
CvPoint2D32f center
Definition: types_c.h:1175
struct CvSetElem CvSetElem
void *(CV_CDECL * CvCloneFunc)(const void *struct_ptr)
Definition: types_c.h:1852
uint64 u
Definition: types_c.h:209
uchar * ptr
Definition: types_c.h:656
Definition: types_c.h:1808
float * fl
Definition: types_c.h:659
CvSeq * seq
Definition: types_c.h:1838
GLenum GLint GLint y
Definition: core_c.h:613
double x
Definition: types_c.h:1117
struct CvSeq CvSeq
uchar * ptr
Definition: types_c.h:1187
int curidx
Definition: types_c.h:894
CvFileNode * node
Definition: core_c.h:1638
Definition: types_c.h:239
Definition: types_c.h:1421
Definition: types_c.h:816
int height
Definition: types_c.h:508
void(CV_CDECL * CvReleaseFunc)(void **struct_dblptr)
Definition: types_c.h:1848
IplImage CvRect * roi
Definition: legacy.hpp:234
Definition: types_c.h:1021
signed char schar
Definition: types_c.h:174
Definition: types_c.h:1857
struct CvMemBlock * next
Definition: types_c.h:1266
int nRows
Definition: types_c.h:526
Definition: types_c.h:890
Definition: types_c.h:1885
uint64 CvRNG
Definition: types_c.h:399
int idxoffset
Definition: types_c.h:869
int CvScalar value
Definition: core_c.h:340
int hdr_refcount
Definition: types_c.h:863
struct CvMatND::@103 dim[CV_MAX_DIM]
GLuint start
Definition: types_c.h:1875
struct CvMemBlock * prev
Definition: types_c.h:1265
int type
Definition: types_c.h:999
int origin
Definition: types_c.h:477
CvMatND mat
Definition: types_c.h:927
void ** hashtable
Definition: types_c.h:866
int CvScalar * scalar
Definition: core_c.h:209
struct CvSeqWriter CvSeqWriter
const char ** attr
Definition: types_c.h:1757
const CvMat CvMat int method CV_DEFAULT(CV_FM_RANSAC)
float thresh[CV_MAX_DIM][2]
Definition: types_c.h:925
CV_INLINE int cvCeil(double value)
Definition: types_c.h:360
int height
Definition: types_c.h:667
struct CvSet * heap
Definition: types_c.h:865
int * values
Definition: types_c.h:518
int nChannels
Definition: types_c.h:469
Definition: types_c.h:921
CV_INLINE int cvFloor(double value)
Definition: types_c.h:343
int i
Definition: types_c.h:1836
Definition: types_c.h:951
Definition: types_c.h:523
Definition: types_c.h:1459
Definition: types_c.h:1138
double * db
Definition: types_c.h:828
int nCols
Definition: types_c.h:525
struct CvSparseNode * next
Definition: types_c.h:886
struct CvSlice CvSlice
int CvHistType
Definition: types_c.h:905
struct CvSeqReader CvSeqReader
int anchorY
Definition: types_c.h:517
Definition: types_c.h:265
union Cv32suf Cv32suf
int64 i
Definition: types_c.h:208
float x
Definition: types_c.h:1077
int height
Definition: types_c.h:1141
GLenum GLsizei width
Definition: types_c.h:247
Definition: types_c.h:240
float ** thresh2
Definition: types_c.h:926
float width
Definition: types_c.h:1157
int anchorY
Definition: types_c.h:528
CV_INLINE CvScalar cvRealScalar(double val0)
Definition: types_c.h:1239
short * s
Definition: types_c.h:657
int cols
Definition: types_c.h:672
void(CV_CDECL * CvWriteFunc)(CvFileStorage *storage, const char *name, const void *struct_ptr, CvAttrList attributes)
Definition: types_c.h:1850
struct CvSparseMat CvSparseMat
Definition: types_c.h:1353
CV_INLINE CvPoint cvPoint(int x, int y)
Definition: types_c.h:1029
struct CvLineIterator CvLineIterator
Definition: types_c.h:1755
int width
Definition: types_c.h:507
CV_INLINE double cvmGet(const CvMat *mat, int row, int col)
Definition: types_c.h:763
int loaded_from
Definition: types_c.h:1881
schar * data
Definition: types_c.h:1305
GLsizei GLsizei GLenum GLenum const GLvoid * data
Definition: core_c.h:403
Definition: types_c.h:858
CvIsInstanceFunc is_instance
Definition: types_c.h:1864
CV_INLINE CvPoint3D64f cvPoint3D64f(double x, double y, double z)
Definition: types_c.h:1124
int align
Definition: types_c.h:479
Definition: types_c.h:235
CvRect r
Definition: core_c.h:1282
struct CvPoint3D64f CvPoint3D64f
int type
Definition: types_c.h:923
Definition: types_c.h:251
CvCloneFunc clone
Definition: types_c.h:1868
Definition: types_c.h:228
Definition: types_c.h:238
struct CvSize2D32f CvSize2D32f
Definition: types_c.h:252
CvRNG * rng
Definition: core_c.h:652
CV_INLINE CvPoint cvPointFrom32f(CvPoint2D32f point)
Definition: types_c.h:1065
Definition: types_c.h:237
Definition: types_c.h:1446
int y
Definition: types_c.h:1024
double val[4]
Definition: types_c.h:1225
struct _IplTileInfo IplTileInfo
Definition: types_c.h:500
struct CvAttrList * next
Definition: types_c.h:1758
void *(CV_CDECL * CvReadFunc)(CvFileStorage *storage, CvFileNode *node)
Definition: types_c.h:1849
Definition: types_c.h:1155
float y
Definition: types_c.h:1078
struct CvRect CvRect
struct CvSparseMatIterator CvSparseMatIterator
char * imageData
Definition: types_c.h:490
Definition: types_c.h:270
void * imageId
Definition: types_c.h:485
CV_INLINE CvSize cvSize(int width, int height)
Definition: types_c.h:1145
double y
Definition: types_c.h:1099
Definition: types_c.h:1298
int(CV_CDECL * CvIsInstanceFunc)(const void *struct_ptr)
Definition: types_c.h:1847
Definition: types_c.h:259
struct CvHistogram CvHistogram
CV_INLINE int cvRound(double value)
Definition: types_c.h:308
int depth
Definition: types_c.h:471
int xOffset
Definition: types_c.h:505
CvRect rect
Definition: core_c.h:100
Definition: types_c.h:248
double CvStereoLineCoeff CvPoint3D64f * point
Definition: legacy.hpp:558
Definition: types_c.h:1202
int tag
Definition: types_c.h:1830
int imageSize
Definition: types_c.h:487
Definition: types_c.h:242
Definition: types_c.h:224
Definition: types_c.h:1184
typedef void(CV_CDECL *CvMouseCallback)(int event
CV_INLINE IplROI cvRectToROI(CvRect rect, int coi)
Definition: types_c.h:973
int yOffset
Definition: types_c.h:506
struct CvPoint CvPoint
CV_INLINE CvTermCriteria cvTermCriteria(int type, int max_iter, double epsilon)
Definition: types_c.h:1007
int * i
Definition: types_c.h:658
Definition: types_c.h:269
int step
Definition: types_c.h:836
char * ptr
Definition: types_c.h:1811
CV_GRAPH_VERTEX_FIELDS() CvPoint2D32f *ptr
const char * name
Definition: core_c.h:1538
int step
Definition: types_c.h:648
int alphaChannel
Definition: types_c.h:470
Definition: types_c.h:261
double start
Definition: core_c.h:774
CvString str
Definition: types_c.h:1820
struct CvMatND CvMatND
Definition: types_c.h:260
Definition: types_c.h:250
GLenum GLenum GLvoid * row
CvFileNodeHash * map
Definition: types_c.h:1839
Definition: types_c.h:1415
CV_INLINE CvPoint2D32f cvPointTo32f(CvPoint point)
Definition: types_c.h:1059
unsigned __int64 uint64_t
Definition: dist.h:39
struct CvMat CvMat
struct CvStringHashNode * next
Definition: types_c.h:1821
int width
Definition: types_c.h:673
Definition: types_c.h:218
GLuint GLfloat * val
Definition: types_c.h:268
int height
Definition: types_c.h:956
int type
Definition: types_c.h:647
Definition: types_c.h:1602
int width
Definition: highgui_c.h:130
Definition: types_c.h:246
struct CvModuleInfo CvModuleInfo
struct _IplConvKernelFP IplConvKernelFP
int end_index
Definition: types_c.h:1204
struct CvSeqBlock CvSeqBlock
char channelSeq[4]
Definition: types_c.h:474
int coi
Definition: types_c.h:504
int free_space
Definition: types_c.h:1279
CvSparseNode * node
Definition: types_c.h:893
Definition: types_c.h:1364
unsigned hashval
Definition: types_c.h:885
struct CvMemStoragePos CvMemStoragePos
struct CvSet CvSet
int width
Definition: types_c.h:955
char * imageDataOrigin
Definition: types_c.h:494
CvArr const CvMat * mat
Definition: core_c.h:700
short * s
Definition: types_c.h:830
GLenum GLsizei GLsizei height
CV_INLINE int cvIsNaN(double value)
Definition: types_c.h:379
int type
Definition: types_c.h:860
Definition: types_c.h:258
Definition: types_c.h:1272
union CvMat::@97 data
struct _IplImage IplImage
CV_INLINE CvScalar cvScalar(double val0, double val1 CV_DEFAULT(0), double val2 CV_DEFAULT(0), double val3 CV_DEFAULT(0))
Definition: types_c.h:1229
Definition: types_c.h:245
int coi
Definition: core_c.h:94
struct _IplConvKernel IplConvKernel
Definition: types_c.h:263
struct CvTypeInfo * info
Definition: types_c.h:1831
Definition: types_c.h:1436
struct CvSparseNode CvSparseNode
CvSize2D32f size
Definition: types_c.h:1176
int y
Definition: types_c.h:954
Definition: types_c.h:234
int err
Definition: types_c.h:1190
size_t size_t CvMemStorage * storage
Definition: core_c.h:946
int width
Definition: types_c.h:1140
struct CvSeqBlock * next
Definition: types_c.h:1301
GLenum GLint x
Definition: core_c.h:632
Definition: types_c.h:206
int CVStatus
Definition: types_c.h:214
CvSparseMat * mat
Definition: types_c.h:892
int dims
Definition: types_c.h:819
Definition: types_c.h:230
Definition: types_c.h:256
void CvArr
Definition: types_c.h:196
CvReadFunc read
Definition: types_c.h:1866
const char * name
Definition: types_c.h:1888
struct CvFileStorage CvFileStorage
Definition: types_c.h:1740
CvSlice slice
Definition: core_c.h:1053
struct _IplROI * roi
Definition: types_c.h:483
int dims
Definition: types_c.h:861
struct CvSeqBlock * prev
Definition: types_c.h:1300
int x
Definition: types_c.h:1023
Definition: types_c.h:232
int * i
Definition: types_c.h:829
Definition: types_c.h:1828
Definition: types_c.h:262
union Cv64suf Cv64suf
CV_SEQUENCE_FIELDS() CvPoint origin
Definition: types_c.h:257
int hashsize
Definition: types_c.h:867
CV_INLINE CvPoint3D32f cvPoint3D32f(double x, double y, double z)
Definition: types_c.h:1084
float * fl
Definition: types_c.h:827
const char * type_name
Definition: types_c.h:1863
Definition: types_c.h:645
int valoffset
Definition: types_c.h:868
Definition: types_c.h:225
struct CvGenericHash CvFileNodeHash
Definition: types_c.h:1825
int nSize
Definition: types_c.h:467
CV_INLINE CvAttrList cvAttrList(const char **attr CV_DEFAULT(NULL), CvAttrList *next CV_DEFAULT(NULL))
Definition: types_c.h:1762
struct CvTypeInfo * prev
Definition: types_c.h:1861
GLdouble GLdouble z
struct CvFileNode CvFileNode
int signature
Definition: types_c.h:1274
Definition: types_c.h:1288
int minus_step
Definition: types_c.h:1194
Definition: types_c.h:227
int rows
Definition: core_c.h:114
struct CvPoint2D32f CvPoint2D32f
CV_INLINE CvScalar cvScalarAll(double val0123)
Definition: types_c.h:1247
struct CvTypeInfo CvTypeInfo
struct CvTypeInfo * next
Definition: types_c.h:1862
Definition: types_c.h:465
Definition: types_c.h:226
Definition: types_c.h:997
CV_INLINE CvRNG cvRNG(int64 seed CV_DEFAULT(-1))
Definition: types_c.h:403
Definition: types_c.h:254
typedef int64_t(APIENTRYP GLEEPFNGLXSWAPBUFFERSMSCOMLPROC)(Display *dpy
int int y
Definition: highgui_c.h:186
struct CvScalar CvScalar
Definition: types_c.h:217
double f
Definition: types_c.h:1835
GLsizei const GLfloat * value
Definition: core_c.h:341
float * values
Definition: types_c.h:529
GLuint GLuint end
float angle
Definition: types_c.h:1177
struct CvContour CvContour
CV_INLINE double cvRandReal(CvRNG *rng)
Definition: types_c.h:419
void ** func_addr
Definition: types_c.h:1877
int nRows
Definition: types_c.h:515
int ID
Definition: types_c.h:468
int cols
Definition: core_c.h:109
Definition: types_c.h:267
GLfloat GLfloat p
GLuint GLuint GLsizei GLenum type
Definition: core_c.h:114
int BorderMode[4]
Definition: types_c.h:492
__int64 int64
Definition: types_c.h:158
int start_index
Definition: types_c.h:1302
union CvFileNode::@104 data
int len
Definition: types_c.h:1810
CV_INLINE CvPoint2D32f cvPoint2D32f(double x, double y)
Definition: types_c.h:1048
int int type
Definition: core_c.h:109
struct CvGraph CvGraph
int * refcount
Definition: types_c.h:651
CV_INLINE CvSize2D32f cvSize2D32f(double width, double height)
Definition: types_c.h:1163
char colorModel[4]
Definition: types_c.h:473
struct CvGraphVtx2D CvGraphVtx2D
CvPluginFuncInfo * func_tab
Definition: types_c.h:1890
int rows
Definition: types_c.h:666
Definition: types_c.h:1173
unsigned short ushort
Definition: types_c.h:171
CvMemBlock * top
Definition: types_c.h:1276
unsigned hashval
Definition: types_c.h:1819
Definition: types_c.h:198
Definition: types_c.h:266
union CvMatND::@102 data
double f
Definition: types_c.h:210
float y
Definition: types_c.h:1043
int plus_step
Definition: types_c.h:1193
int block_size
Definition: types_c.h:1278
Definition: types_c.h:255
Definition: types_c.h:1223
const char * ptr
Definition: core_c.h:942
Definition: types_c.h:1817
int nShiftR
Definition: types_c.h:519
Definition: types_c.h:264
struct CvSize CvSize
CvMemBlock * bottom
Definition: types_c.h:1275
struct CvPoint2D64f CvPoint2D64f
int hdr_refcount
Definition: types_c.h:822
Definition: types_c.h:243
Definition: types_c.h:1409
CV_INLINE CvSlice cvSlice(int start, int end)
Definition: types_c.h:1208
Definition: types_c.h:502
double * db
Definition: types_c.h:660
struct _IplImage * maskROI
Definition: types_c.h:484
Definition: types_c.h:233
Definition: types_c.h:223
struct CvMemStorage * parent
Definition: types_c.h:1277
int BorderConst[4]
Definition: types_c.h:493
struct CvModuleInfo * next
Definition: types_c.h:1887
unsigned char uchar
Definition: types_c.h:170
Definition: types_c.h:1333
int int height
Definition: highgui_c.h:130
::max::max::max float
Definition: functional.hpp:326
Definition: types_c.h:1263
struct CvString CvString
struct CvBox2D CvBox2D
struct CvStringHashNode CvStringHashNode
const void * struct_ptr
Definition: core_c.h:1681
::max::max int
Definition: functional.hpp:324
Definition: types_c.h:883
int dataOrder
Definition: types_c.h:475
void * default_func_addr
Definition: types_c.h:1878
const char * func_names
Definition: types_c.h:1879
Definition: types_c.h:1620
double epsilon
Definition: types_c.h:1003
int search_modules
Definition: types_c.h:1880
int widthStep
Definition: types_c.h:491
Definition: types_c.h:1075
CvMemBlock * top
Definition: types_c.h:1290
int x
Definition: highgui_c.h:186
int start_index
Definition: types_c.h:1204
struct _IplROI IplROI
int plus_delta
Definition: types_c.h:1191
double double end
Definition: core_c.h:774
double x
Definition: types_c.h:1098
Definition: types_c.h:219
int size
Definition: types_c.h:835
CV_INLINE int cvIplDepth(int type)
Definition: types_c.h:798
float f
Definition: types_c.h:202
Definition: types_c.h:236
int count
Definition: types_c.h:1304
const GLfloat * m
unsigned u
Definition: types_c.h:201
float x
Definition: types_c.h:1042
Definition: types_c.h:231
Definition: types_c.h:229
CvArr CvArr * temp
Definition: imgproc_c.h:242
int x
Definition: types_c.h:953
GLint GLint GLsizei GLsizei GLsizei depth
Definition: core_c.h:76
int anchorX
Definition: types_c.h:527
unsigned __int64 uint64
Definition: types_c.h:159
int type
Definition: types_c.h:818
CvString str
Definition: types_c.h:1837
Definition: types_c.h:1040
int width
Definition: types_c.h:481
CV_INLINE CvPoint2D64f cvPoint2D64f(double x, double y)
Definition: types_c.h:1104
struct CvAttrList CvAttrList
GLdouble GLdouble t
GLdouble s
CV_INLINE unsigned cvRandInt(CvRNG *rng)
Definition: types_c.h:410
const char * version
Definition: types_c.h:1889
Definition: types_c.h:249
CV_INLINE CvRect cvROIToRect(IplROI roi)
Definition: types_c.h:986
Definition: types_c.h:241
int * refcount
Definition: types_c.h:862
CvReleaseFunc release
Definition: types_c.h:1865
struct _IplTileInfo * tileInfo
Definition: types_c.h:486
struct CvGraphVtx CvGraphVtx
uchar * ptr
Definition: types_c.h:826
double y
Definition: types_c.h:1118
Definition: types_c.h:221
struct CvMemBlock CvMemBlock
CV_INLINE void cvmSet(CvMat *mat, int row, int col, double value)
Definition: types_c.h:781
int * refcount
Definition: types_c.h:821
struct CvMemStorage CvMemStorage
Definition: types_c.h:222
GLsizeiptr size
Definition: core_c.h:939
CV_INLINE CvMat cvMat(int rows, int cols, int type, void *data CV_DEFAULT(NULL))
Definition: types_c.h:733
int minus_delta
Definition: types_c.h:1192
Definition: types_c.h:1115
CV_INLINE CvRect cvRect(int x, int y, int width, int height)
Definition: types_c.h:960
CvWriteFunc write
Definition: types_c.h:1867
float z
Definition: types_c.h:1079
CvContour CvPoint2DSeq
Definition: types_c.h:1465
const CvArr * next
Definition: tracking.hpp:102
struct CvPluginFuncInfo CvPluginFuncInfo
int hdr_refcount
Definition: types_c.h:652
int nCols
Definition: types_c.h:514
int header_size
Definition: types_c.h:1860
struct CvPoint3D32f CvPoint3D32f
struct CvChain CvChain
Definition: types_c.h:220
CV_INLINE int cvIsInf(double value)
Definition: types_c.h:388
struct CvGraphEdge CvGraphEdge
Definition: types_c.h:512
int max_iter
Definition: types_c.h:1002
Definition: types_c.h:1096
int flags
Definition: types_c.h:1859
CvArr * bins
Definition: types_c.h:924