visageSDK

vs_core_types_c.h
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 __VS_CORE_TYPES_H__
44 #define __VS_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 VS_ICC __ICL
66 #elif defined __ICC
67 # define VS_ICC __ICC
68 #elif defined __ECL
69 # define VS_ICC __ECL
70 #elif defined __ECC
71 # define VS_ICC __ECC
72 #elif defined __INTEL_COMPILER
73 # define VS_ICC __INTEL_COMPILER
74 #endif
75
76 #if defined VS_ICC && !defined VS_ENABLE_UNROLLED
77 # define VS_ENABLE_UNROLLED 0
78 #else
79 # define VS_ENABLE_UNROLLED 1
80 #endif
81
82 #if (defined _M_X64 && defined _MSC_VER && _MSC_VER >= 1400) || (defined __GNUC__ && __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 #include <math.h>
92
93 #endif // SKIP_INCLUDES
94
95 #if defined WIN32 || defined _WIN32
96 # define VS_CDECL __cdecl
97 # define VS_STDCALL __stdcall
98 #else
99 # define VS_CDECL
100 # define VS_STDCALL
101 #endif
102
103 #ifndef VS_EXTERN_C
104 # ifdef __cplusplus
105 # define VS_EXTERN_C extern "C"
106 # define VS_DEFAULT(val) = val
107 # else
108 # define VS_EXTERN_C
109 # define VS_DEFAULT(val)
110 # endif
111 #endif
112
113 #ifndef VS_EXTERN_C_FUNCPTR
114 # ifdef __cplusplus
115 # define VS_EXTERN_C_FUNCPTR(x) extern "C" { typedef x; }
116 # else
117 # define VS_EXTERN_C_FUNCPTR(x) typedef x
118 # endif
119 #endif
120
121 #ifndef VS_INLINE
122 # if defined __cplusplus
123 # define VS_INLINE inline
124 # elif defined _MSC_VER
125 # define VS_INLINE __inline
126 # else
127 # define VS_INLINE static
128 # endif
129 #endif /* VS_INLINE */
130
131 #if (defined WIN32 || defined _WIN32 || defined WINCE) && defined CVAPI_EXPORTS
132 # define VS_EXPORTS __declspec(dllexport)
133 #else
134 # define VS_EXPORTS
135 #endif
136
137 #ifndef CVAPI
138 # define CVAPI(rettype) VS_EXTERN_C VS_EXPORTS rettype VS_CDECL
139 #endif
140
141 #ifndef VSAPI
142 #if (defined WIN32 || defined _WIN32 || defined WINCE)
143 # define VSAPI(rettype) __declspec(dllexport) rettype VS_CDECL
144 #else
145 # define VSAPI(rettype) VS_EXTERN_C VS_EXPORTS rettype VS_CDECL
146 #endif
147 #endif
148
149 #if defined _MSC_VER || defined __BORLANDC__
150 typedef __int64 int64;
151 typedef unsigned __int64 uint64;
152 # define VS_BIG_INT(n) n##I64
153 # define VS_BIG_UINT(n) n##UI64
154 #else
155 typedef int64_t int64;
156 typedef uint64_t uint64;
157 # define VS_BIG_INT(n) n##LL
158 # define VS_BIG_UINT(n) n##ULL
159 #endif
160
161 #ifndef HAVE_IPL
162 typedef unsigned char uchar;
163 typedef unsigned short ushort;
164 #endif
165
166 typedef signed char schar;
167
168 /* special informative macros for wrapper generators */
169 #define VS_CARRAY(counter)
170 #define VS_CUSTOM_CARRAY(args)
171 #define VS_EXPORTS_W VS_EXPORTS
172 #define VS_EXPORTS_W_SIMPLE VS_EXPORTS
173 #define VS_EXPORTS_AS(synonym) VS_EXPORTS
174 #define VS_EXPORTS_W_MAP VS_EXPORTS
175 #define VS_IN_OUT
176 #define VS_OUT
177 #define VS_PROP
178 #define VS_PROP_RW
179 #define VS_WRAP
180 #define VS_WRAP_AS(synonym)
181 #define VS_WRAP_DEFAULT(value)
182
183 /* VsArr* is used to pass arbitrary
184 * array-like data structures
185 * into functions where the particular
186 * array type is recognized at runtime:
187 */
188 typedef void VsArr;
189
190 typedef union Vs32suf
191 {
192 int i;
193 unsigned u;
194 float f;
195 }
196 Vs32suf;
197
198 typedef union Vs64suf
199 {
200 int64 i;
201 uint64 u;
202 double f;
203 }
204 Vs64suf;
205
206 typedef int VSStatus;
207
208 enum {
209 VS_StsOk= 0, /* everithing is ok */
210 VS_StsBackTrace= -1, /* pseudo error for back trace */
211 VS_StsError= -2, /* unknown /unspecified error */
212 VS_StsInternal= -3, /* internal error (bad state) */
213 VS_StsNoMem= -4, /* insufficient memory */
214 VS_StsBadArg= -5, /* function arg/param is bad */
215 VS_StsBadFunc= -6, /* unsupported function */
216 VS_StsNoConv= -7, /* iter. didn't converge */
217 VS_StsAutoTrace= -8, /* tracing */
218 VS_HeaderIsNull= -9, /* image header is NULL */
219 VS_BadImageSize= -10, /* image size is invalid */
220 VS_BadOffset= -11, /* offset is invalid */
221 VS_BadDataPtr= -12,
222 VS_BadStep= -13,
223 VS_BadModelOrChSeq= -14,
224 VS_BadNumChannels= -15,
225 VS_BadNumChannel1U= -16,
226 VS_BadDepth= -17,
227 VS_BadAlphaChannel= -18,
228 VS_BadOrder= -19,
229 VS_BadOrigin= -20,
230 VS_BadAlign= -21,
231 VS_BadCallBack= -22,
232 VS_BadTileSize= -23,
233 VS_BadCOI= -24,
234 VS_BadROISize= -25,
235 VS_MaskIsTiled= -26,
236 VS_StsNullPtr= -27, /* null pointer */
237 VS_StsVecLengthErr= -28, /* incorrect vector length */
238 VS_StsFilterStructContentErr= -29, /* incorr. filter structure content */
239 VS_StsKernelStructContentErr= -30, /* incorr. transform kernel content */
240 VS_StsFilterOffsetErr= -31, /* incorrect filter offset value */
241 VS_StsBadSize= -201, /* the input/output structure size is incorrect */
242 VS_StsDivByZero= -202, /* division by zero */
243 VS_StsInplaceNotSupported= -203, /* in-place operation is not supported */
244 VS_StsObjectNotFound= -204, /* request can't be completed */
245 VS_StsUnmatchedFormats= -205, /* formats of input/output arrays differ */
246 VS_StsBadFlag= -206, /* flag is wrong or not supported */
247 VS_StsBadPoint= -207, /* bad VsPoint */
248 VS_StsBadMask= -208, /* bad format of mask (neither 8uC1 nor 8sC1)*/
249 VS_StsUnmatchedSizes= -209, /* sizes of input/output structures do not match */
250 VS_StsUnsupportedFormat= -210, /* the data format/type is not supported by the function*/
251 VS_StsOutOfRange= -211, /* some of parameters are out of range */
252 VS_StsParseError= -212, /* invalid syntax/structure of the parsed file */
253 VS_StsNotImplemented= -213, /* the requested function/feature is not implemented */
254 VS_StsBadMemBlock= -214, /* an allocated block has been corrupted */
255 VS_StsAssert= -215, /* assertion failed */
256 VS_GpuNotSupported= -216,
257 VS_GpuApiCallError= -217,
258 VS_OpenGlNotSupported= -218,
259 VS_OpenGlApiCallError= -219,
260 VS_OpenCLDoubleNotSupported= -220,
261 VS_OpenCLInitError= -221,
262 VS_OpenCLNoAMDBlasFft= -222
263 };
264
265 /****************************************************************************************\
266 * Common macros and inline functions *
267 \****************************************************************************************/
268
269 #ifdef HAVE_TEGRA_OPTIMIZATION
270 # include "tegra_round.hpp"
271 #endif
272
273 #define VS_PI 3.1415926535897932384626433832795
274 #define VS_LOG2 0.69314718055994530941723212145818
275
276 #define VS_SWAP(a,b,t) ((t) = (a), (a) = (b), (b) = (t))
277
278 #ifndef MIN
279 # define MIN(a,b) ((a) > (b) ? (b) : (a))
280 #endif
281
282 #ifndef MAX
283 # define MAX(a,b) ((a) < (b) ? (b) : (a))
284 #endif
285
286 /* min & max without jumps */
287 #define VS_IMIN(a, b) ((a) ^ (((a)^(b)) & (((a) < (b)) - 1)))
288
289 #define VS_IMAX(a, b) ((a) ^ (((a)^(b)) & (((a) > (b)) - 1)))
290
291 /* absolute value without jumps */
292 #ifndef __cplusplus
293 # define VS_IABS(a) (((a) ^ ((a) < 0 ? -1 : 0)) - ((a) < 0 ? -1 : 0))
294 #else
295 # define VS_IABS(a) abs(a)
296 #endif
297 #define VS_CMP(a,b) (((a) > (b)) - ((a) < (b)))
298 #define VS_SIGN(a) VS_CMP((a),0)
299
300 VS_INLINE int vsRound( double value )
301 {
302 #if (defined _MSC_VER && defined _M_X64) || (defined __GNUC__ && defined __x86_64__ && defined __SSE2__ && !defined __APPLE__)
303 __m128d t = _mm_set_sd( value );
304 return _mm_cvtsd_si32(t);
305 #elif defined _MSC_VER && defined _M_IX86
306 int t;
307 __asm
308 {
309 fld value;
310 fistp t;
311 }
312 return t;
313 #elif defined _MSC_VER && defined _M_ARM && defined HAVE_TEGRA_OPTIMIZATION
314 TEGRA_ROUND(value);
315 #elif defined VS_ICC || defined __GNUC__
316 # ifdef HAVE_TEGRA_OPTIMIZATION
317 TEGRA_ROUND(value);
318 # else
319 return (int)lrint(value);
320 # endif
321 #else
322 double intpart, fractpart;
323 fractpart = modf(value, &intpart);
324 if ((fabs(fractpart) != 0.5) || ((((int)intpart) % 2) != 0))
325 return (int)(value + (value >= 0 ? 0.5 : -0.5));
326 else
327 return (int)intpart;
328 #endif
329 }
330
331 #if defined __SSE2__ || (defined _M_IX86_FP && 2 == _M_IX86_FP)
332 # include "emmintrin.h"
333 #endif
334
335 VS_INLINE int vsFloor( double value )
336 {
337 #if defined _MSC_VER && defined _M_X64 || (defined __GNUC__ && defined __SSE2__ && !defined __APPLE__)
338 __m128d t = _mm_set_sd( value );
339 int i = _mm_cvtsd_si32(t);
340 return i - _mm_movemask_pd(_mm_cmplt_sd(t, _mm_cvtsi32_sd(t,i)));
341 #elif defined __GNUC__
342 int i = (int)value;
343 return i - (i > value);
344 #else
345 int i = vsRound(value);
346 float diff = (float)(value - i);
347 return i - (diff < 0);
348 #endif
349 }
350
351
352 VS_INLINE int vsCeil( double value )
353 {
354 #if defined _MSC_VER && defined _M_X64 || (defined __GNUC__ && defined __SSE2__&& !defined __APPLE__)
355 __m128d t = _mm_set_sd( value );
356 int i = _mm_cvtsd_si32(t);
357 return i + _mm_movemask_pd(_mm_cmplt_sd(_mm_cvtsi32_sd(t,i), t));
358 #elif defined __GNUC__
359 int i = (int)value;
360 return i + (i < value);
361 #else
362 int i = vsRound(value);
363 float diff = (float)(i - value);
364 return i + (diff < 0);
365 #endif
366 }
367
368 #define vsInvSqrt(value) ((float)(1./sqrt(value)))
369 #define vsSqrt(value) ((float)sqrt(value))
370
371 VS_INLINE int vsIsNaN( double value )
372 {
373 Vs64suf ieee754;
374 ieee754.f = value;
375 return ((unsigned)(ieee754.u >> 32) & 0x7fffffff) +
376 ((unsigned)ieee754.u != 0) > 0x7ff00000;
377 }
378
379
380 VS_INLINE int vsIsInf( double value )
381 {
382 Vs64suf ieee754;
383 ieee754.f = value;
384 return ((unsigned)(ieee754.u >> 32) & 0x7fffffff) == 0x7ff00000 &&
385 (unsigned)ieee754.u == 0;
386 }
387
388
389 /*************** Random number generation *******************/
390
391 typedef uint64 VsRNG;
392
393 #define VS_RNG_COEFF 4164903690U
394
395 VS_INLINE VsRNG vsRNG( int64 seed VS_DEFAULT(-1))
396 {
397 VsRNG rng = seed ? (uint64)seed : (uint64)(int64)-1;
398 return rng;
399 }
400
401 /* Return random 32-bit unsigned integer: */
402 VS_INLINE unsigned vsRandInt( VsRNG* rng )
403 {
404 uint64 temp = *rng;
405 temp = (uint64)(unsigned)temp*VS_RNG_COEFF + (temp >> 32);
406 *rng = temp;
407 return (unsigned)temp;
408 }
409
410 /* Returns random floating-point number between 0 and 1: */
411 VS_INLINE double vsRandReal( VsRNG* rng )
412 {
413 return vsRandInt(rng)*2.3283064365386962890625e-10 /* 2^-32 */;
414 }
415
416 /****************************************************************************************\
417 * Image type (VsImage) *
418 \****************************************************************************************/
419
420 #ifndef HAVE_IPL
421
422 /*
423 * The following definitions (until #endif)
424 * is an extract from IPL headers.
425 * Copyright (c) 1995 Intel Corporation.
426 */
427 #define VS_DEPTH_SIGN 0x80000000
428
429 #define VS_DEPTH_1U 1
430 #define VS_DEPTH_8U 8
431 #define VS_DEPTH_16U 16
432 #define VS_DEPTH_32F 32
433
434 #define VS_DEPTH_8S (VS_DEPTH_SIGN| 8)
435 #define VS_DEPTH_16S (VS_DEPTH_SIGN|16)
436 #define VS_DEPTH_32S (VS_DEPTH_SIGN|32)
437
438 #define VS_DATA_ORDER_PIXEL 0
439 #define VS_DATA_ORDER_PLANE 1
440
441 #define VS_ORIGIN_TL 0
442 #define VS_ORIGIN_BL 1
443
444 #define VS_ALIGN_4BYTES 4
445 #define VS_ALIGN_8BYTES 8
446 #define VS_ALIGN_16BYTES 16
447 #define VS_ALIGN_32BYTES 32
448
449 #define VS_ALIGN_DWORD VS_ALIGN_4BYTES
450 #define VS_ALIGN_QWORD VS_ALIGN_8BYTES
451
452 #define VS_BORDER_CONSTANT 0
453 #define VS_BORDER_REPLICATE 1
454 #define VS_BORDER_REFLECT 2
455 #define VS_BORDER_WRAP 3
456
460 typedef struct _VsImage
461 {
462 int nSize;
463 int ID;
464 int nChannels;
465 int alphaChannel;
466 int depth;
468 char colorModel[4];
469 char channelSeq[4];
470 int dataOrder;
472 int origin;
474 int align;
476 int width;
477 int height;
478 struct _VsROI *roi;
479 struct _VsImage *maskROI;
480 void *imageId;
481 struct _VsTileInfo *tileInfo;
482 int imageSize;
485 char *imageData;
486 int widthStep;
487 int BorderMode[4];
488 int BorderConst[4];
489 char *imageDataOrigin;
492 }
493 VsImage;
494
495 typedef struct _VsTileInfo VsTileInfo;
496
497 typedef struct _VsROI
498 {
499 int coi; /* 0 - no COI (all channels are selected), 1 - 0th channel is selected ...*/
500 int xOffset;
501 int yOffset;
502 int width;
503 int height;
504 }
505 VsROI;
506
507 typedef struct _VsConvKernel
508 {
509 int nCols;
510 int nRows;
511 int anchorX;
512 int anchorY;
513 int *values;
514 int nShiftR;
515 }
516 VsConvKernel;
517
518 typedef struct _VsConvKernelFP
519 {
520 int nCols;
521 int nRows;
522 int anchorX;
523 int anchorY;
524 float *values;
525 }
526 VsConvKernelFP;
527
528 #define VS_IMAGE_HEADER 1
529 #define VS_IMAGE_DATA 2
530 #define VS_IMAGE_ROI 4
531
532 #endif/*HAVE_IPL*/
533
534 /* extra border mode */
535 #define VS_BORDER_REFLECT_101 4
536 #define VS_BORDER_TRANSPARENT 5
537
538 #define VS_IMAGE_MAGIC_VAL ((int)sizeof(VsImage))
539 #define VS_TYPE_NAME_IMAGE "opencv-image"
540
541 #define VS_IS_IMAGE_HDR(img) \
542 ((img) != NULL && ((const VsImage*)(img))->nSize == sizeof(VsImage))
543
544 #define VS_IS_IMAGE(img) \
545 (VS_IS_IMAGE_HDR(img) && ((VsImage*)img)->imageData != NULL)
546
547 /* for storing double-precision
548 floating point data in VsImage's */
549 #define VS_DEPTH_64F 64
550
551 /* get reference to pixel at (col,row),
552 for multi-channel images (col) should be multiplied by number of channels */
553 #define VS_IMAGE_ELEM( image, elemtype, row, col ) \
554 (((elemtype*)((image)->imageData + (image)->widthStep*(row)))[(col)])
555
556 /****************************************************************************************\
557 * Matrix type (VsMat) *
558 \****************************************************************************************/
559
560 #define VS_CN_MAX 512
561 #define VS_CN_SHIFT 3
562 #define VS_DEPTH_MAX (1 << VS_CN_SHIFT)
563
564 #define VS_8U 0
565 #define VS_8S 1
566 #define VS_16U 2
567 #define VS_16S 3
568 #define VS_32S 4
569 #define VS_32F 5
570 #define VS_64F 6
571 #define VS_USRTYPE1 7
572
573 #define VS_MAT_DEPTH_MASK (VS_DEPTH_MAX - 1)
574 #define VS_MAT_DEPTH(flags) ((flags) & VS_MAT_DEPTH_MASK)
575
576 #define VS_MAKETYPE(depth,cn) (VS_MAT_DEPTH(depth) + (((cn)-1) << VS_CN_SHIFT))
577 #define VS_MAKE_TYPE VS_MAKETYPE
578
579 #define VS_8UC1 VS_MAKETYPE(VS_8U,1)
580 #define VS_8UC2 VS_MAKETYPE(VS_8U,2)
581 #define VS_8UC3 VS_MAKETYPE(VS_8U,3)
582 #define VS_8UC4 VS_MAKETYPE(VS_8U,4)
583 #define VS_8UC(n) VS_MAKETYPE(VS_8U,(n))
584
585 #define VS_8SC1 VS_MAKETYPE(VS_8S,1)
586 #define VS_8SC2 VS_MAKETYPE(VS_8S,2)
587 #define VS_8SC3 VS_MAKETYPE(VS_8S,3)
588 #define VS_8SC4 VS_MAKETYPE(VS_8S,4)
589 #define VS_8SC(n) VS_MAKETYPE(VS_8S,(n))
590
591 #define VS_16UC1 VS_MAKETYPE(VS_16U,1)
592 #define VS_16UC2 VS_MAKETYPE(VS_16U,2)
593 #define VS_16UC3 VS_MAKETYPE(VS_16U,3)
594 #define VS_16UC4 VS_MAKETYPE(VS_16U,4)
595 #define VS_16UC(n) VS_MAKETYPE(VS_16U,(n))
596
597 #define VS_16SC1 VS_MAKETYPE(VS_16S,1)
598 #define VS_16SC2 VS_MAKETYPE(VS_16S,2)
599 #define VS_16SC3 VS_MAKETYPE(VS_16S,3)
600 #define VS_16SC4 VS_MAKETYPE(VS_16S,4)
601 #define VS_16SC(n) VS_MAKETYPE(VS_16S,(n))
602
603 #define VS_32SC1 VS_MAKETYPE(VS_32S,1)
604 #define VS_32SC2 VS_MAKETYPE(VS_32S,2)
605 #define VS_32SC3 VS_MAKETYPE(VS_32S,3)
606 #define VS_32SC4 VS_MAKETYPE(VS_32S,4)
607 #define VS_32SC(n) VS_MAKETYPE(VS_32S,(n))
608
609 #define VS_32FC1 VS_MAKETYPE(VS_32F,1)
610 #define VS_32FC2 VS_MAKETYPE(VS_32F,2)
611 #define VS_32FC3 VS_MAKETYPE(VS_32F,3)
612 #define VS_32FC4 VS_MAKETYPE(VS_32F,4)
613 #define VS_32FC(n) VS_MAKETYPE(VS_32F,(n))
614
615 #define VS_64FC1 VS_MAKETYPE(VS_64F,1)
616 #define VS_64FC2 VS_MAKETYPE(VS_64F,2)
617 #define VS_64FC3 VS_MAKETYPE(VS_64F,3)
618 #define VS_64FC4 VS_MAKETYPE(VS_64F,4)
619 #define VS_64FC(n) VS_MAKETYPE(VS_64F,(n))
620
621 #define VS_AUTO_STEP 0x7fffffff
622 #define VS_WHOLE_ARR vsSlice( 0, 0x3fffffff )
623
624 #define VS_MAT_CN_MASK ((VS_CN_MAX - 1) << VS_CN_SHIFT)
625 #define VS_MAT_CN(flags) ((((flags) & VS_MAT_CN_MASK) >> VS_CN_SHIFT) + 1)
626 #define VS_MAT_TYPE_MASK (VS_DEPTH_MAX*VS_CN_MAX - 1)
627 #define VS_MAT_TYPE(flags) ((flags) & VS_MAT_TYPE_MASK)
628 #define VS_MAT_CONT_FLAG_SHIFT 14
629 #define VS_MAT_CONT_FLAG (1 << VS_MAT_CONT_FLAG_SHIFT)
630 #define VS_IS_MAT_CONT(flags) ((flags) & VS_MAT_CONT_FLAG)
631 #define VS_IS_CONT_MAT VS_IS_MAT_CONT
632 #define VS_SUBMAT_FLAG_SHIFT 15
633 #define VS_SUBMAT_FLAG (1 << VS_SUBMAT_FLAG_SHIFT)
634 #define VS_IS_SUBMAT(flags) ((flags) & VS_MAT_SUBMAT_FLAG)
635
636 #define VS_MAGIC_MASK 0xFFFF0000
637 #define VS_MAT_MAGIC_VAL 0x42420000
638 #define VS_TYPE_NAME_MAT "opencv-matrix"
639
640 typedef struct VsMat
641 {
642 int type;
643 int step;
644
645 /* for internal use only */
646 int* refcount;
647 int hdr_refcount;
648
649 union
650 {
651 uchar* ptr;
652 short* s;
653 int* i;
654 float* fl;
655 double* db;
656 } data;
657
658 #ifdef __cplusplus
659 union
660 {
661 int rows;
662 int height;
663 };
664
665 union
666 {
667 int cols;
668 int width;
669 };
670 #else
671 int rows;
672 int cols;
673 #endif
674
675 }
676 VsMat;
677
678
679
680 #define VS_IS_MAT_HDR(mat) \
681 ((mat) != NULL && \
682 (((const VsMat*)(mat))->type & VS_MAGIC_MASK) == VS_MAT_MAGIC_VAL && \
683 ((const VsMat*)(mat))->cols > 0 && ((const VsMat*)(mat))->rows > 0)
684
685 #define VS_IS_MAT_HDR_Z(mat) \
686 ((mat) != NULL && \
687 (((const VsMat*)(mat))->type & VS_MAGIC_MASK) == VS_MAT_MAGIC_VAL && \
688 ((const VsMat*)(mat))->cols >= 0 && ((const VsMat*)(mat))->rows >= 0)
689
690 #define VS_IS_MAT(mat) \
691 (VS_IS_MAT_HDR(mat) && ((const VsMat*)(mat))->data.ptr != NULL)
692
693 #define VS_IS_MASK_ARR(mat) \
694 (((mat)->type & (VS_MAT_TYPE_MASK & ~VS_8SC1)) == 0)
695
696 #define VS_ARE_TYPES_EQ(mat1, mat2) \
697 ((((mat1)->type ^ (mat2)->type) & VS_MAT_TYPE_MASK) == 0)
698
699 #define VS_ARE_CNS_EQ(mat1, mat2) \
700 ((((mat1)->type ^ (mat2)->type) & VS_MAT_CN_MASK) == 0)
701
702 #define VS_ARE_DEPTHS_EQ(mat1, mat2) \
703 ((((mat1)->type ^ (mat2)->type) & VS_MAT_DEPTH_MASK) == 0)
704
705 #define VS_ARE_SIZES_EQ(mat1, mat2) \
706 ((mat1)->rows == (mat2)->rows && (mat1)->cols == (mat2)->cols)
707
708 #define VS_IS_MAT_CONST(mat) \
709 (((mat)->rows|(mat)->cols) == 1)
710
711 /* Size of each channel item,
712 0x124489 = 1000 0100 0100 0010 0010 0001 0001 ~ array of sizeof(arr_type_elem) */
713 #define VS_ELEM_SIZE1(type) \
714 ((((sizeof(size_t)<<28)|0x8442211) >> VS_MAT_DEPTH(type)*4) & 15)
715
716 /* 0x3a50 = 11 10 10 01 01 00 00 ~ array of log2(sizeof(arr_type_elem)) */
717 #define VS_ELEM_SIZE(type) \
718 (VS_MAT_CN(type) << ((((sizeof(size_t)/4+1)*16384|0x3a50) >> VS_MAT_DEPTH(type)*2) & 3))
719
720 #define IPL2VS_DEPTH(depth) \
721 ((((VS_8U)+(VS_16U<<4)+(VS_32F<<8)+(VS_64F<<16)+(VS_8S<<20)+ \
722 (VS_16S<<24)+(VS_32S<<28)) >> ((((depth) & 0xF0) >> 2) + \
723 (((depth) & VS_DEPTH_SIGN) ? 20 : 0))) & 15)
724
725 /* Inline constructor. No data is allocated internally!!!
726 * (Use together with vsCreateData, or use vsCreateMat instead to
727 * get a matrix with allocated data):
728 */
729 VS_INLINE VsMat vsMat( int rows, int cols, int type, void* data VS_DEFAULT(NULL))
730 {
731 VsMat m;
732
733 assert( (unsigned)VS_MAT_DEPTH(type) <= VS_64F );
734 type = VS_MAT_TYPE(type);
735 m.type = VS_MAT_MAGIC_VAL | VS_MAT_CONT_FLAG | type;
736 m.cols = cols;
737 m.rows = rows;
738 m.step = m.cols*VS_ELEM_SIZE(type);
739 m.data.ptr = (uchar*)data;
740 m.refcount = NULL;
741 m.hdr_refcount = 0;
742
743 return m;
744 }
745
746
747 #define VS_MAT_ELEM_PTR_FAST( mat, row, col, pix_size ) \
748 (assert( (unsigned)(row) < (unsigned)(mat).rows && \
749 (unsigned)(col) < (unsigned)(mat).cols ), \
750 (mat).data.ptr + (size_t)(mat).step*(row) + (pix_size)*(col))
751
752 #define VS_MAT_ELEM_PTR( mat, row, col ) \
753 VS_MAT_ELEM_PTR_FAST( mat, row, col, VS_ELEM_SIZE((mat).type) )
754
755 #define VS_MAT_ELEM( mat, elemtype, row, col ) \
756 (*(elemtype*)VS_MAT_ELEM_PTR_FAST( mat, row, col, sizeof(elemtype)))
757
758
759 VS_INLINE double vsmGet( const VsMat* mat, int row, int col )
760 {
761 int type;
762
763 type = VS_MAT_TYPE(mat->type);
764 assert( (unsigned)row < (unsigned)mat->rows &&
765 (unsigned)col < (unsigned)mat->cols );
766
767 if( type == VS_32FC1 )
768 return ((float*)(void*)(mat->data.ptr + (size_t)mat->step*row))[col];
769 else
770 {
771 assert( type == VS_64FC1 );
772 return ((double*)(void*)(mat->data.ptr + (size_t)mat->step*row))[col];
773 }
774 }
775
776
777 VS_INLINE void vsmSet( VsMat* mat, int row, int col, double value )
778 {
779 int type;
780 type = VS_MAT_TYPE(mat->type);
781 assert( (unsigned)row < (unsigned)mat->rows &&
782 (unsigned)col < (unsigned)mat->cols );
783
784 if( type == VS_32FC1 )
785 ((float*)(void*)(mat->data.ptr + (size_t)mat->step*row))[col] = (float)value;
786 else
787 {
788 assert( type == VS_64FC1 );
789 ((double*)(void*)(mat->data.ptr + (size_t)mat->step*row))[col] = value;
790 }
791 }
792
793
794 VS_INLINE int vsIplDepth( int type )
795 {
796 int depth = VS_MAT_DEPTH(type);
797 return VS_ELEM_SIZE1(depth)*8 | (depth == VS_8S || depth == VS_16S ||
798 depth == VS_32S ? VS_DEPTH_SIGN : 0);
799 }
800
801
802 /****************************************************************************************\
803 * Multi-dimensional dense array (VsMatND) *
804 \****************************************************************************************/
805
806 #define VS_MATND_MAGIC_VAL 0x42430000
807 #define VS_TYPE_NAME_MATND "opencv-nd-matrix"
808
809 #define VS_MAX_DIM 32
810 #define VS_MAX_DIM_HEAP 1024
811
812 /****************************************************************************************\
813 * Histogram *
814 \****************************************************************************************/
815
816 typedef int VsHistType;
817
818 #define VS_HIST_MAGIC_VAL 0x42450000
819 #define VS_HIST_UNIFORM_FLAG (1 << 10)
820
821 /* indicates whether bin ranges are set already or not */
822 #define VS_HIST_RANGES_FLAG (1 << 11)
823
824 #define VS_HIST_ARRAY 0
825 #define VS_HIST_SPARSE 1
826 #define VS_HIST_TREE VS_HIST_SPARSE
827
828 /* should be used as a parameter only,
829 it turns to VS_HIST_UNIFORM_FLAG of hist->type */
830 #define VS_HIST_UNIFORM 1
831
832
833
834 #define VS_IS_HIST( hist ) \
835 ((hist) != NULL && \
836 (((VsHistogram*)(hist))->type & VS_MAGIC_MASK) == VS_HIST_MAGIC_VAL && \
837 (hist)->bins != NULL)
838
839 #define VS_IS_UNIFORM_HIST( hist ) \
840 (((hist)->type & VS_HIST_UNIFORM_FLAG) != 0)
841
842 #define VS_IS_SPARSE_HIST( hist ) \
843 VS_IS_SPARSE_MAT((hist)->bins)
844
845 #define VS_HIST_HAS_RANGES( hist ) \
846 (((hist)->type & VS_HIST_RANGES_FLAG) != 0)
847
848 /****************************************************************************************\
849 * Other supplementary data type definitions *
850 \****************************************************************************************/
851
852 /*************************************** VsRect *****************************************/
853
854 typedef struct VsRect
855 {
856 int x;
857 int y;
858 int width;
859 int height;
860 }
861 VsRect;
862
863 VS_INLINE VsRect vsRect( int x, int y, int width, int height )
864 {
865 VsRect r;
866
867 r.x = x;
868 r.y = y;
869 r.width = width;
870 r.height = height;
871
872 return r;
873 }
874
875
876 VS_INLINE VsROI vsRectToROI( VsRect rect, int coi )
877 {
878 VsROI roi;
879 roi.xOffset = rect.x;
880 roi.yOffset = rect.y;
881 roi.width = rect.width;
882 roi.height = rect.height;
883 roi.coi = coi;
884
885 return roi;
886 }
887
888
889 VS_INLINE VsRect vsROIToRect( VsROI roi )
890 {
891 return vsRect( roi.xOffset, roi.yOffset, roi.width, roi.height );
892 }
893
894 /* VsRect32f*/
895
896 typedef struct VsRect32f
897 {
898 float x;
899 float y;
900 float width;
901 float height;
902 }
903 VsRect32f;
904
905 VS_INLINE VsRect32f vsRect32f(float x, float y, float width, float height)
906 {
907 VsRect32f r;
908
909 r.x = x;
910 r.y = y;
911 r.width = width;
912 r.height = height;
913
914 return r;
915 }
916
917
918 VS_INLINE VsROI vsRect32fToROI(VsRect32f rect, float coi)
919 {
920 VsROI roi;
921 roi.xOffset = static_cast<int>(rect.x);
922 roi.yOffset = static_cast<int>(rect.y);
923 roi.width = static_cast<int>(rect.width);
924 roi.height = static_cast<int>(rect.height);
925 roi.coi = static_cast<int>(coi);
926
927 return roi;
928 }
929
930
931 VS_INLINE VsRect32f vsROIToRect32f(VsROI roi)
932 {
933 return vsRect32f(static_cast<float>(roi.xOffset), static_cast<float>(roi.yOffset), static_cast<float>(roi.width), static_cast<float>(roi.height));
934 }
935
936 /*********************************** VsTermCriteria *************************************/
937
938 #define VS_TERMCRIT_ITER 1
939 #define VS_TERMCRIT_NUMBER VS_TERMCRIT_ITER
940 #define VS_TERMCRIT_EPS 2
941
942 typedef struct VsTermCriteria
943 {
944 int type; /* may be combination of
945 VS_TERMCRIT_ITER
946 VS_TERMCRIT_EPS */
947 int max_iter;
948 double epsilon;
949 }
950 VsTermCriteria;
951
952 VS_INLINE VsTermCriteria vsTermCriteria( int type, int max_iter, double epsilon )
953 {
954 VsTermCriteria t;
955
956 t.type = type;
957 t.max_iter = max_iter;
958 t.epsilon = (float)epsilon;
959
960 return t;
961 }
962
963
964 /******************************* VsPoint and variants ***********************************/
965
966 typedef struct VsPoint
967 {
968 int x;
969 int y;
970 }
971 VsPoint;
972
973
974 VS_INLINE VsPoint vsPoint( int x, int y )
975 {
976 VsPoint p;
977
978 p.x = x;
979 p.y = y;
980
981 return p;
982 }
983
984
985 typedef struct VsPoint2D32f
986 {
987 float x;
988 float y;
989 }
990 VsPoint2D32f;
991
992
993 VS_INLINE VsPoint2D32f vsPoint2D32f( double x, double y )
994 {
995 VsPoint2D32f p;
996
997 p.x = (float)x;
998 p.y = (float)y;
999
1000 return p;
1001 }
1002
1003
1004 VS_INLINE VsPoint2D32f vsPointTo32f( VsPoint point )
1005 {
1006 return vsPoint2D32f( (float)point.x, (float)point.y );
1007 }
1008
1009
1010 VS_INLINE VsPoint vsPointFrom32f( VsPoint2D32f point )
1011 {
1012 VsPoint ipt;
1013 ipt.x = vsRound(point.x);
1014 ipt.y = vsRound(point.y);
1015
1016 return ipt;
1017 }
1018
1019
1020 typedef struct VsPoint3D32f
1021 {
1022 float x;
1023 float y;
1024 float z;
1025 }
1026 VsPoint3D32f;
1027
1028
1029 VS_INLINE VsPoint3D32f vsPoint3D32f( double x, double y, double z )
1030 {
1031 VsPoint3D32f p;
1032
1033 p.x = (float)x;
1034 p.y = (float)y;
1035 p.z = (float)z;
1036
1037 return p;
1038 }
1039
1040
1041 typedef struct VsPoint2D64f
1042 {
1043 double x;
1044 double y;
1045 }
1046 VsPoint2D64f;
1047
1048
1049 VS_INLINE VsPoint2D64f vsPoint2D64f( double x, double y )
1050 {
1051 VsPoint2D64f p;
1052
1053 p.x = x;
1054 p.y = y;
1055
1056 return p;
1057 }
1058
1059
1060 typedef struct VsPoint3D64f
1061 {
1062 double x;
1063 double y;
1064 double z;
1065 }
1066 VsPoint3D64f;
1067
1068
1069 VS_INLINE VsPoint3D64f vsPoint3D64f( double x, double y, double z )
1070 {
1071 VsPoint3D64f p;
1072
1073 p.x = x;
1074 p.y = y;
1075 p.z = z;
1076
1077 return p;
1078 }
1079
1080
1081 /******************************** VsSize's & CvBox **************************************/
1082
1083 typedef struct VsSize
1084 {
1085 int width;
1086 int height;
1087 }
1088 VsSize;
1089
1090 VS_INLINE VsSize vsSize( int width, int height )
1091 {
1092 VsSize s;
1093
1094 s.width = width;
1095 s.height = height;
1096
1097 return s;
1098 }
1099
1100 typedef struct VsSize2D32f
1101 {
1102 float width;
1103 float height;
1104 }
1105 VsSize2D32f;
1106
1107
1108 VS_INLINE VsSize2D32f vsSize2D32f( double width, double height )
1109 {
1110 VsSize2D32f s;
1111
1112 s.width = (float)width;
1113 s.height = (float)height;
1114
1115 return s;
1116 }
1117
1118 typedef struct VsBox2D
1119 {
1120 VsPoint2D32f center; /* Center of the box. */
1121 VsSize2D32f size; /* Box width and length. */
1122 float angle; /* Angle between the horizontal axis */
1123 /* and the first side (i.e. length) in degrees */
1124 }
1125 VsBox2D;
1126
1127
1128 /* Line iterator state: */
1129 typedef struct VsLineIterator
1130 {
1131 /* Pointer to the current point: */
1132 uchar* ptr;
1133
1134 /* Bresenham algorithm state: */
1135 int err;
1136 int plus_delta;
1137 int minus_delta;
1138 int plus_step;
1139 int minus_step;
1140 }
1141 VsLineIterator;
1142
1143
1144
1145 /************************************* VsSlice ******************************************/
1146
1147 typedef struct VsSlice
1148 {
1149 int start_index, end_index;
1150 }
1151 VsSlice;
1152
1153 VS_INLINE VsSlice vsSlice( int start, int end )
1154 {
1155 VsSlice slice;
1156 slice.start_index = start;
1157 slice.end_index = end;
1158
1159 return slice;
1160 }
1161
1162 #define VS_WHOLE_SEQ_END_INDEX 0x3fffffff
1163 #define VS_WHOLE_SEQ vsSlice(0, VS_WHOLE_SEQ_END_INDEX)
1164
1165
1166 /************************************* VsScalar *****************************************/
1167
1168 typedef struct VsScalar
1169 {
1170 double val[4];
1171 }
1172 VsScalar;
1173
1174 VS_INLINE VsScalar vsScalar( double val0, double val1 VS_DEFAULT(0),
1175 double val2 VS_DEFAULT(0), double val3 VS_DEFAULT(0))
1176 {
1177 VsScalar scalar;
1178 scalar.val[0] = val0; scalar.val[1] = val1;
1179 scalar.val[2] = val2; scalar.val[3] = val3;
1180 return scalar;
1181 }
1182
1183
1184 VS_INLINE VsScalar vsRealScalar( double val0 )
1185 {
1186 VsScalar scalar;
1187 scalar.val[0] = val0;
1188 scalar.val[1] = scalar.val[2] = scalar.val[3] = 0;
1189 return scalar;
1190 }
1191
1192 VS_INLINE VsScalar vsScalarAll( double val0123 )
1193 {
1194 VsScalar scalar;
1195 scalar.val[0] = val0123;
1196 scalar.val[1] = val0123;
1197 scalar.val[2] = val0123;
1198 scalar.val[3] = val0123;
1199 return scalar;
1200 }
1201
1202 /****************************************************************************************\
1203 * Dynamic Data structures *
1204 \****************************************************************************************/
1205
1206 /******************************** Memory storage ****************************************/
1207
1208 typedef struct VsMemBlock
1209 {
1210 struct VsMemBlock* prev;
1211 struct VsMemBlock* next;
1212 }
1213 VsMemBlock;
1214
1215 #define VS_STORAGE_MAGIC_VAL 0x42890000
1216
1217 typedef struct VsMemStorage
1218 {
1219 int signature;
1220 VsMemBlock* bottom; /* First allocated block. */
1221 VsMemBlock* top; /* Current memory block - top of the stack. */
1222 struct VsMemStorage* parent; /* We get new blocks from parent as needed. */
1223 int block_size; /* Block size. */
1224 int free_space; /* Remaining free space in current block. */
1225 }
1226 VsMemStorage;
1227
1228 #define VS_IS_STORAGE(storage) \
1229 ((storage) != NULL && \
1230 (((VsMemStorage*)(storage))->signature & VS_MAGIC_MASK) == VS_STORAGE_MAGIC_VAL)
1231
1232
1233 typedef struct VsMemStoragePos
1234 {
1235 VsMemBlock* top;
1236 int free_space;
1237 }
1238 VsMemStoragePos;
1239
1240
1241 /*********************************** Sequence *******************************************/
1242
1243 typedef struct VsSeqBlock
1244 {
1245 struct VsSeqBlock* prev; /* Previous sequence block. */
1246 struct VsSeqBlock* next; /* Next sequence block. */
1247 int start_index; /* Index of the first element in the block + */
1248 /* sequence->first->start_index. */
1249 int count; /* Number of elements in the block. */
1250 schar* data; /* Pointer to the first element of the block. */
1251 }
1252 VsSeqBlock;
1253
1254
1255 #define VS_TREE_NODE_FIELDS(node_type) \
1256 int flags; /* Miscellaneous flags. */ \
1257 int header_size; /* Size of sequence header. */ \
1258 struct node_type* h_prev; /* Previous sequence. */ \
1259 struct node_type* h_next; /* Next sequence. */ \
1260 struct node_type* v_prev; /* 2nd previous sequence. */ \
1261 struct node_type* v_next /* 2nd next sequence. */
1262
1263 /*
1264 Read/Write sequence.
1265 Elements can be dynamically inserted to or deleted from the sequence.
1266 */
1267 #define VS_SEQUENCE_FIELDS() \
1268 VS_TREE_NODE_FIELDS(VsSeq); \
1269 int total; /* Total number of elements. */ \
1270 int elem_size; /* Size of sequence element in bytes. */ \
1271 schar* block_max; /* Maximal bound of the last block. */ \
1272 schar* ptr; /* Current write pointer. */ \
1273 int delta_elems; /* Grow seq this many at a time. */ \
1274 VsMemStorage* storage; /* Where the seq is stored. */ \
1275 VsSeqBlock* free_blocks; /* Free blocks list. */ \
1276 VsSeqBlock* first; /* Pointer to the first sequence block. */
1277
1278 #define VS_TYPE_NAME_SEQ "vs-sequence"
1279 #define VS_TYPE_NAME_SEQ_TREE "vs-sequence-tree"
1280
1281 /*************************************** Set ********************************************/
1282 /*
1283 Set.
1284 Order is not preserved. There can be gaps between sequence elements.
1285 After the element has been inserted it stays in the same place all the time.
1286 The MSB(most-significant or sign bit) of the first field (flags) is 0 iff the element exists.
1287 */
1288 #define VS_SET_ELEM_FIELDS(elem_type) \
1289 int flags; \
1290 struct elem_type* next_free;
1291
1292 typedef struct VsSetElem
1293 {
1294 VS_SET_ELEM_FIELDS(VsSetElem)
1295 }
1296 VsSetElem;
1297
1298 #define VS_SET_FIELDS() \
1299 VS_SEQUENCE_FIELDS() \
1300 VsSetElem* free_elems; \
1301 int active_count;
1302
1303 typedef struct VsSet
1304 {
1305 VS_SET_FIELDS()
1306 }
1307 VsSet;
1308
1309
1310 #define VS_SET_ELEM_IDX_MASK ((1 << 26) - 1)
1311 #define VS_SET_ELEM_FREE_FLAG (1 << (sizeof(int)*8-1))
1312
1313 /* Checks whether the element pointed by ptr belongs to a set or not */
1314 #define VS_IS_SET_ELEM( ptr ) (((VsSetElem*)(ptr))->flags >= 0)
1315
1316 /****************************************************************************************\
1317 * Sequence types *
1318 \****************************************************************************************/
1319
1320 #define VS_SET_MAGIC_VAL 0x42980000
1321 #define VS_IS_SET(set) \
1322 ((set) != NULL && (((VsSeq*)(set))->flags & VS_MAGIC_MASK) == VS_SET_MAGIC_VAL)
1323
1324 /****************************************************************************************\
1325 * Data structures for persistence (a.k.a serialization) functionality *
1326 \****************************************************************************************/
1327
1328
1329 #define VS_NODE_NONE 0
1330 #define VS_NODE_INT 1
1331 #define VS_NODE_INTEGER VS_NODE_INT
1332 #define VS_NODE_REAL 2
1333 #define VS_NODE_FLOAT VS_NODE_REAL
1334 #define VS_NODE_STR 3
1335 #define VS_NODE_STRING VS_NODE_STR
1336 #define VS_NODE_REF 4 /* not used */
1337 #define VS_NODE_SEQ 5
1338 #define VS_NODE_MAP 6
1339 #define VS_NODE_TYPE_MASK 7
1340
1341 #define VS_NODE_TYPE(flags) ((flags) & VS_NODE_TYPE_MASK)
1342
1343 /* file node flags */
1344 #define VS_NODE_FLOW 8 /* Used only for writing structures in YAML format. */
1345 #define VS_NODE_USER 16
1346 #define VS_NODE_EMPTY 32
1347 #define VS_NODE_NAMED 64
1348
1349 #define VS_NODE_IS_INT(flags) (VS_NODE_TYPE(flags) == VS_NODE_INT)
1350 #define VS_NODE_IS_REAL(flags) (VS_NODE_TYPE(flags) == VS_NODE_REAL)
1351 #define VS_NODE_IS_STRING(flags) (VS_NODE_TYPE(flags) == VS_NODE_STRING)
1352 #define VS_NODE_IS_SEQ(flags) (VS_NODE_TYPE(flags) == VS_NODE_SEQ)
1353 #define VS_NODE_IS_MAP(flags) (VS_NODE_TYPE(flags) == VS_NODE_MAP)
1354 #define VS_NODE_IS_COLLECTION(flags) (VS_NODE_TYPE(flags) >= VS_NODE_SEQ)
1355 #define VS_NODE_IS_FLOW(flags) (((flags) & VS_NODE_FLOW) != 0)
1356 #define VS_NODE_IS_EMPTY(flags) (((flags) & VS_NODE_EMPTY) != 0)
1357 #define VS_NODE_IS_USER(flags) (((flags) & VS_NODE_USER) != 0)
1358 #define VS_NODE_HAS_NAME(flags) (((flags) & VS_NODE_NAMED) != 0)
1359
1360 #define VS_NODE_SEQ_SIMPLE 256
1361 #define VS_NODE_SEQ_IS_SIMPLE(seq) (((seq)->flags & VS_NODE_SEQ_SIMPLE) != 0)
1362
1363 typedef struct VsString
1364 {
1365 int len;
1366 char* ptr;
1367 }
1368 VsString;
1369
1370 #endif /*__VS_CORE_TYPES_H__*/
1371
1372 /* End of file. */
VsImage::height
int height
Image height in pixels.
Definition: vs_core_types_c.h:477
VsImage::imageData
char * imageData
Pointer to aligned image data.
Definition: vs_core_types_c.h:485
VsImage::ID
int ID
version (=0)
Definition: vs_core_types_c.h:463
VsImage::nChannels
int nChannels
Most of OpenCV functions support 1,2,3 or 4 channels.
Definition: vs_core_types_c.h:464
VsImage::width
int width
Image width in pixels.
Definition: vs_core_types_c.h:476
VsImage::imageId
void * imageId
Must be NULL.
Definition: vs_core_types_c.h:480
VsImage::nSize
int nSize
sizeof(VsImage)
Definition: vs_core_types_c.h:462
VsImage::depth
int depth
Pixel depth in bits: VS_DEPTH_8U, VS_DEPTH_8S, VS_DEPTH_16S, VS_DEPTH_32S, VS_DEPTH_32F and VS_DEPTH_...
Definition: vs_core_types_c.h:466
VsImage::imageSize
int imageSize
Image data size in bytes (==image->height*image->widthStep in case of interleaved data) ...
Definition: vs_core_types_c.h:482
VsImage::alphaChannel
int alphaChannel
Ignored by OpenCV.
Definition: vs_core_types_c.h:465
VsImage::maskROI
struct _VsImage * maskROI
Must be NULL.
Definition: vs_core_types_c.h:479
VsImage::imageDataOrigin
char * imageDataOrigin
Pointer to very origin of image data (not necessarily aligned) - needed for correct deallocation...
Definition: vs_core_types_c.h:489
VsImage::roi
struct _VsROI * roi
Image ROI.
Definition: vs_core_types_c.h:478
VsImage::dataOrder
int dataOrder
0 - interleaved color channels, 1 - separate color channels.
Definition: vs_core_types_c.h:470
VsImage::origin
int origin
0 - top-left origin, 1 - bottom-left origin (Windows bitmaps style).
Definition: vs_core_types_c.h:472
VsImage::widthStep
int widthStep
Size of aligned image row in bytes.
Definition: vs_core_types_c.h:486
VsImage::tileInfo
struct _VsTileInfo * tileInfo
Must be NULL.
Definition: vs_core_types_c.h:481
VsImage
Image store container.
Definition: vs_core_types_c.h:460
VsImage::align
int align
Alignment of image rows (4 or 8).
Definition: vs_core_types_c.h:474