43 #ifndef __VS_CORE_TYPES_H__ 44 #define __VS_CORE_TYPES_H__ 46 #if !defined _CRT_SECURE_NO_DEPRECATE && defined _MSC_VER 48 # define _CRT_SECURE_NO_DEPRECATE 60 #if !defined _MSC_VER && !defined __BORLANDC__ 72 #elif defined __INTEL_COMPILER 73 # define VS_ICC __INTEL_COMPILER 76 #if defined VS_ICC && !defined VS_ENABLE_UNROLLED 77 # define VS_ENABLE_UNROLLED 0 79 # define VS_ENABLE_UNROLLED 1 82 #if (defined _M_X64 && defined _MSC_VER && _MSC_VER >= 1400) || (defined __GNUC__ && __GNUC__ >= 4 && defined __x86_64__) 86 # if defined __SSE2__ || !defined __GNUC__ 87 # include <emmintrin.h> 93 #endif // SKIP_INCLUDES 95 #if defined WIN32 || defined _WIN32 96 # define VS_CDECL __cdecl 97 # define VS_STDCALL __stdcall 105 # define VS_EXTERN_C extern "C" 106 # define VS_DEFAULT(val) = val 109 # define VS_DEFAULT(val) 113 #ifndef VS_EXTERN_C_FUNCPTR 115 # define VS_EXTERN_C_FUNCPTR(x) extern "C" { typedef x; } 117 # define VS_EXTERN_C_FUNCPTR(x) typedef x 122 # if defined __cplusplus 123 # define VS_INLINE inline 124 # elif defined _MSC_VER 125 # define VS_INLINE __inline 127 # define VS_INLINE static 131 #if (defined WIN32 || defined _WIN32 || defined WINCE) && defined CVAPI_EXPORTS 132 # define VS_EXPORTS __declspec(dllexport) 138 # define CVAPI(rettype) VS_EXTERN_C VS_EXPORTS rettype VS_CDECL 142 #if (defined WIN32 || defined _WIN32 || defined WINCE) 143 # define VSAPI(rettype) __declspec(dllexport) rettype VS_CDECL 145 # define VSAPI(rettype) VS_EXTERN_C VS_EXPORTS rettype VS_CDECL 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 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 162 typedef unsigned char uchar;
163 typedef unsigned short ushort;
166 typedef signed char schar;
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 180 #define VS_WRAP_AS(synonym) 181 #define VS_WRAP_DEFAULT(value) 190 typedef union Vs32suf
198 typedef union Vs64suf
206 typedef int VSStatus;
219 VS_BadImageSize= -10,
223 VS_BadModelOrChSeq= -14,
224 VS_BadNumChannels= -15,
225 VS_BadNumChannel1U= -16,
227 VS_BadAlphaChannel= -18,
237 VS_StsVecLengthErr= -28,
238 VS_StsFilterStructContentErr= -29,
239 VS_StsKernelStructContentErr= -30,
240 VS_StsFilterOffsetErr= -31,
242 VS_StsDivByZero= -202,
243 VS_StsInplaceNotSupported= -203,
244 VS_StsObjectNotFound= -204,
245 VS_StsUnmatchedFormats= -205,
247 VS_StsBadPoint= -207,
249 VS_StsUnmatchedSizes= -209,
250 VS_StsUnsupportedFormat= -210,
251 VS_StsOutOfRange= -211,
252 VS_StsParseError= -212,
253 VS_StsNotImplemented= -213,
254 VS_StsBadMemBlock= -214,
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
269 #ifdef HAVE_TEGRA_OPTIMIZATION 270 # include "tegra_round.hpp" 273 #define VS_PI 3.1415926535897932384626433832795 274 #define VS_LOG2 0.69314718055994530941723212145818 276 #define VS_SWAP(a,b,t) ((t) = (a), (a) = (b), (b) = (t)) 279 # define MIN(a,b) ((a) > (b) ? (b) : (a)) 283 # define MAX(a,b) ((a) < (b) ? (b) : (a)) 287 #define VS_IMIN(a, b) ((a) ^ (((a)^(b)) & (((a) < (b)) - 1))) 289 #define VS_IMAX(a, b) ((a) ^ (((a)^(b)) & (((a) > (b)) - 1))) 293 # define VS_IABS(a) (((a) ^ ((a) < 0 ? -1 : 0)) - ((a) < 0 ? -1 : 0)) 295 # define VS_IABS(a) abs(a) 297 #define VS_CMP(a,b) (((a) > (b)) - ((a) < (b))) 298 #define VS_SIGN(a) VS_CMP((a),0) 300 VS_INLINE
int vsRound(
double value )
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 313 #elif defined _MSC_VER && defined _M_ARM && defined HAVE_TEGRA_OPTIMIZATION 315 #elif defined VS_ICC || defined __GNUC__ 316 # ifdef HAVE_TEGRA_OPTIMIZATION 319 return (
int)lrint(value);
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));
331 #if defined __SSE2__ || (defined _M_IX86_FP && 2 == _M_IX86_FP) 332 # include "emmintrin.h" 335 VS_INLINE
int vsFloor(
double value )
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__ 343 return i - (i > value);
345 int i = vsRound(value);
346 float diff = (float)(value - i);
347 return i - (diff < 0);
352 VS_INLINE
int vsCeil(
double value )
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__ 360 return i + (i < value);
362 int i = vsRound(value);
363 float diff = (float)(i - value);
364 return i + (diff < 0);
368 #define vsInvSqrt(value) ((float)(1./sqrt(value))) 369 #define vsSqrt(value) ((float)sqrt(value)) 371 VS_INLINE
int vsIsNaN(
double value )
375 return ((
unsigned)(ieee754.u >> 32) & 0x7fffffff) +
376 ((unsigned)ieee754.u != 0) > 0x7ff00000;
380 VS_INLINE
int vsIsInf(
double value )
384 return ((
unsigned)(ieee754.u >> 32) & 0x7fffffff) == 0x7ff00000 &&
385 (unsigned)ieee754.u == 0;
391 typedef uint64 VsRNG;
393 #define VS_RNG_COEFF 4164903690U 395 VS_INLINE VsRNG vsRNG( int64 seed VS_DEFAULT(-1))
397 VsRNG rng = seed ? (uint64)seed : (uint64)(int64)-1;
402 VS_INLINE
unsigned vsRandInt( VsRNG* rng )
405 temp = (uint64)(
unsigned)temp*VS_RNG_COEFF + (temp >> 32);
407 return (
unsigned)temp;
411 VS_INLINE
double vsRandReal( VsRNG* rng )
413 return vsRandInt(rng)*2.3283064365386962890625e-10 ;
427 #define VS_DEPTH_SIGN 0x80000000 429 #define VS_DEPTH_1U 1 430 #define VS_DEPTH_8U 8 431 #define VS_DEPTH_16U 16 432 #define VS_DEPTH_32F 32 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) 438 #define VS_DATA_ORDER_PIXEL 0 439 #define VS_DATA_ORDER_PLANE 1 441 #define VS_ORIGIN_TL 0 442 #define VS_ORIGIN_BL 1 444 #define VS_ALIGN_4BYTES 4 445 #define VS_ALIGN_8BYTES 8 446 #define VS_ALIGN_16BYTES 16 447 #define VS_ALIGN_32BYTES 32 449 #define VS_ALIGN_DWORD VS_ALIGN_4BYTES 450 #define VS_ALIGN_QWORD VS_ALIGN_8BYTES 452 #define VS_BORDER_CONSTANT 0 453 #define VS_BORDER_REPLICATE 1 454 #define VS_BORDER_REFLECT 2 455 #define VS_BORDER_WRAP 3 460 typedef struct _VsImage
495 typedef struct _VsTileInfo VsTileInfo;
497 typedef struct _VsROI
507 typedef struct _VsConvKernel
518 typedef struct _VsConvKernelFP
528 #define VS_IMAGE_HEADER 1 529 #define VS_IMAGE_DATA 2 530 #define VS_IMAGE_ROI 4 535 #define VS_BORDER_REFLECT_101 4 536 #define VS_BORDER_TRANSPARENT 5 538 #define VS_IMAGE_MAGIC_VAL ((int)sizeof(VsImage)) 539 #define VS_TYPE_NAME_IMAGE "opencv-image" 541 #define VS_IS_IMAGE_HDR(img) \ 542 ((img) != NULL && ((const VsImage*)(img))->nSize == sizeof(VsImage)) 544 #define VS_IS_IMAGE(img) \ 545 (VS_IS_IMAGE_HDR(img) && ((VsImage*)img)->imageData != NULL) 549 #define VS_DEPTH_64F 64 553 #define VS_IMAGE_ELEM( image, elemtype, row, col ) \ 554 (((elemtype*)((image)->imageData + (image)->widthStep*(row)))[(col)]) 560 #define VS_CN_MAX 512 561 #define VS_CN_SHIFT 3 562 #define VS_DEPTH_MAX (1 << VS_CN_SHIFT) 571 #define VS_USRTYPE1 7 573 #define VS_MAT_DEPTH_MASK (VS_DEPTH_MAX - 1) 574 #define VS_MAT_DEPTH(flags) ((flags) & VS_MAT_DEPTH_MASK) 576 #define VS_MAKETYPE(depth,cn) (VS_MAT_DEPTH(depth) + (((cn)-1) << VS_CN_SHIFT)) 577 #define VS_MAKE_TYPE VS_MAKETYPE 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)) 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)) 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)) 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)) 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)) 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)) 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)) 621 #define VS_AUTO_STEP 0x7fffffff 622 #define VS_WHOLE_ARR vsSlice( 0, 0x3fffffff ) 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) 636 #define VS_MAGIC_MASK 0xFFFF0000 637 #define VS_MAT_MAGIC_VAL 0x42420000 638 #define VS_TYPE_NAME_MAT "opencv-matrix" 680 #define VS_IS_MAT_HDR(mat) \ 682 (((const VsMat*)(mat))->type & VS_MAGIC_MASK) == VS_MAT_MAGIC_VAL && \ 683 ((const VsMat*)(mat))->cols > 0 && ((const VsMat*)(mat))->rows > 0) 685 #define VS_IS_MAT_HDR_Z(mat) \ 687 (((const VsMat*)(mat))->type & VS_MAGIC_MASK) == VS_MAT_MAGIC_VAL && \ 688 ((const VsMat*)(mat))->cols >= 0 && ((const VsMat*)(mat))->rows >= 0) 690 #define VS_IS_MAT(mat) \ 691 (VS_IS_MAT_HDR(mat) && ((const VsMat*)(mat))->data.ptr != NULL) 693 #define VS_IS_MASK_ARR(mat) \ 694 (((mat)->type & (VS_MAT_TYPE_MASK & ~VS_8SC1)) == 0) 696 #define VS_ARE_TYPES_EQ(mat1, mat2) \ 697 ((((mat1)->type ^ (mat2)->type) & VS_MAT_TYPE_MASK) == 0) 699 #define VS_ARE_CNS_EQ(mat1, mat2) \ 700 ((((mat1)->type ^ (mat2)->type) & VS_MAT_CN_MASK) == 0) 702 #define VS_ARE_DEPTHS_EQ(mat1, mat2) \ 703 ((((mat1)->type ^ (mat2)->type) & VS_MAT_DEPTH_MASK) == 0) 705 #define VS_ARE_SIZES_EQ(mat1, mat2) \ 706 ((mat1)->rows == (mat2)->rows && (mat1)->cols == (mat2)->cols) 708 #define VS_IS_MAT_CONST(mat) \ 709 (((mat)->rows|(mat)->cols) == 1) 713 #define VS_ELEM_SIZE1(type) \ 714 ((((sizeof(size_t)<<28)|0x8442211) >> VS_MAT_DEPTH(type)*4) & 15) 717 #define VS_ELEM_SIZE(type) \ 718 (VS_MAT_CN(type) << ((((sizeof(size_t)/4+1)*16384|0x3a50) >> VS_MAT_DEPTH(type)*2) & 3)) 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) 729 VS_INLINE VsMat vsMat(
int rows,
int cols,
int type,
void* data VS_DEFAULT(NULL))
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;
738 m.step = m.cols*VS_ELEM_SIZE(type);
739 m.data.ptr = (uchar*)data;
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)) 752 #define VS_MAT_ELEM_PTR( mat, row, col ) \ 753 VS_MAT_ELEM_PTR_FAST( mat, row, col, VS_ELEM_SIZE((mat).type) ) 755 #define VS_MAT_ELEM( mat, elemtype, row, col ) \ 756 (*(elemtype*)VS_MAT_ELEM_PTR_FAST( mat, row, col, sizeof(elemtype))) 759 VS_INLINE
double vsmGet(
const VsMat* mat,
int row,
int col )
763 type = VS_MAT_TYPE(mat->type);
764 assert( (
unsigned)row < (
unsigned)mat->rows &&
765 (
unsigned)col < (
unsigned)mat->cols );
767 if( type == VS_32FC1 )
768 return ((
float*)(
void*)(mat->data.ptr + (
size_t)mat->step*row))[col];
771 assert( type == VS_64FC1 );
772 return ((
double*)(
void*)(mat->data.ptr + (
size_t)mat->step*row))[col];
777 VS_INLINE
void vsmSet( VsMat* mat,
int row,
int col,
double value )
780 type = VS_MAT_TYPE(mat->type);
781 assert( (
unsigned)row < (
unsigned)mat->rows &&
782 (
unsigned)col < (
unsigned)mat->cols );
784 if( type == VS_32FC1 )
785 ((
float*)(
void*)(mat->data.ptr + (size_t)mat->step*row))[col] = (
float)value;
788 assert( type == VS_64FC1 );
789 ((
double*)(
void*)(mat->data.ptr + (size_t)mat->step*row))[col] = value;
794 VS_INLINE
int vsIplDepth(
int type )
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);
806 #define VS_MATND_MAGIC_VAL 0x42430000 807 #define VS_TYPE_NAME_MATND "opencv-nd-matrix" 809 #define VS_MAX_DIM 32 810 #define VS_MAX_DIM_HEAP 1024 816 typedef int VsHistType;
818 #define VS_HIST_MAGIC_VAL 0x42450000 819 #define VS_HIST_UNIFORM_FLAG (1 << 10) 822 #define VS_HIST_RANGES_FLAG (1 << 11) 824 #define VS_HIST_ARRAY 0 825 #define VS_HIST_SPARSE 1 826 #define VS_HIST_TREE VS_HIST_SPARSE 830 #define VS_HIST_UNIFORM 1 834 #define VS_IS_HIST( hist ) \ 836 (((VsHistogram*)(hist))->type & VS_MAGIC_MASK) == VS_HIST_MAGIC_VAL && \ 837 (hist)->bins != NULL) 839 #define VS_IS_UNIFORM_HIST( hist ) \ 840 (((hist)->type & VS_HIST_UNIFORM_FLAG) != 0) 842 #define VS_IS_SPARSE_HIST( hist ) \ 843 VS_IS_SPARSE_MAT((hist)->bins) 845 #define VS_HIST_HAS_RANGES( hist ) \ 846 (((hist)->type & VS_HIST_RANGES_FLAG) != 0) 854 typedef struct VsRect
863 VS_INLINE VsRect vsRect(
int x,
int y,
int width,
int height )
876 VS_INLINE VsROI vsRectToROI( VsRect rect,
int coi )
879 roi.xOffset = rect.x;
880 roi.yOffset = rect.y;
881 roi.width = rect.width;
882 roi.height = rect.height;
889 VS_INLINE VsRect vsROIToRect( VsROI roi )
891 return vsRect( roi.xOffset, roi.yOffset, roi.width, roi.height );
896 typedef struct VsRect32f
905 VS_INLINE VsRect32f vsRect32f(
float x,
float y,
float width,
float height)
918 VS_INLINE VsROI vsRect32fToROI(VsRect32f rect,
float coi)
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);
931 VS_INLINE VsRect32f vsROIToRect32f(VsROI roi)
933 return vsRect32f(static_cast<float>(roi.xOffset), static_cast<float>(roi.yOffset), static_cast<float>(roi.width), static_cast<float>(roi.height));
938 #define VS_TERMCRIT_ITER 1 939 #define VS_TERMCRIT_NUMBER VS_TERMCRIT_ITER 940 #define VS_TERMCRIT_EPS 2 942 typedef struct VsTermCriteria
952 VS_INLINE VsTermCriteria vsTermCriteria(
int type,
int max_iter,
double epsilon )
957 t.max_iter = max_iter;
958 t.epsilon = (float)epsilon;
966 typedef struct VsPoint
974 VS_INLINE VsPoint vsPoint(
int x,
int y )
985 typedef struct VsPoint2D32f
993 VS_INLINE VsPoint2D32f vsPoint2D32f(
double x,
double y )
1004 VS_INLINE VsPoint2D32f vsPointTo32f( VsPoint point )
1006 return vsPoint2D32f( (
float)point.x, (
float)point.y );
1010 VS_INLINE VsPoint vsPointFrom32f( VsPoint2D32f point )
1013 ipt.x = vsRound(point.x);
1014 ipt.y = vsRound(point.y);
1020 typedef struct VsPoint3D32f
1029 VS_INLINE VsPoint3D32f vsPoint3D32f(
double x,
double y,
double z )
1041 typedef struct VsPoint2D64f
1049 VS_INLINE VsPoint2D64f vsPoint2D64f(
double x,
double y )
1060 typedef struct VsPoint3D64f
1069 VS_INLINE VsPoint3D64f vsPoint3D64f(
double x,
double y,
double z )
1083 typedef struct VsSize
1090 VS_INLINE VsSize vsSize(
int width,
int height )
1100 typedef struct VsSize2D32f
1108 VS_INLINE VsSize2D32f vsSize2D32f(
double width,
double height )
1112 s.width = (float)width;
1113 s.height = (float)height;
1118 typedef struct VsBox2D
1120 VsPoint2D32f center;
1129 typedef struct VsLineIterator
1147 typedef struct VsSlice
1149 int start_index, end_index;
1153 VS_INLINE VsSlice vsSlice(
int start,
int end )
1156 slice.start_index = start;
1157 slice.end_index = end;
1162 #define VS_WHOLE_SEQ_END_INDEX 0x3fffffff 1163 #define VS_WHOLE_SEQ vsSlice(0, VS_WHOLE_SEQ_END_INDEX) 1168 typedef struct VsScalar
1174 VS_INLINE VsScalar vsScalar(
double val0,
double val1 VS_DEFAULT(0),
1175 double val2 VS_DEFAULT(0),
double val3 VS_DEFAULT(0))
1178 scalar.val[0] = val0; scalar.val[1] = val1;
1179 scalar.val[2] = val2; scalar.val[3] = val3;
1184 VS_INLINE VsScalar vsRealScalar(
double val0 )
1187 scalar.val[0] = val0;
1188 scalar.val[1] = scalar.val[2] = scalar.val[3] = 0;
1192 VS_INLINE VsScalar vsScalarAll(
double val0123 )
1195 scalar.val[0] = val0123;
1196 scalar.val[1] = val0123;
1197 scalar.val[2] = val0123;
1198 scalar.val[3] = val0123;
1208 typedef struct VsMemBlock
1210 struct VsMemBlock* prev;
1211 struct VsMemBlock* next;
1215 #define VS_STORAGE_MAGIC_VAL 0x42890000 1217 typedef struct VsMemStorage
1222 struct VsMemStorage* parent;
1228 #define VS_IS_STORAGE(storage) \ 1229 ((storage) != NULL && \ 1230 (((VsMemStorage*)(storage))->signature & VS_MAGIC_MASK) == VS_STORAGE_MAGIC_VAL) 1233 typedef struct VsMemStoragePos
1243 typedef struct VsSeqBlock
1245 struct VsSeqBlock* prev;
1246 struct VsSeqBlock* next;
1255 #define VS_TREE_NODE_FIELDS(node_type) \ 1258 struct node_type* h_prev; \ 1259 struct node_type* h_next; \ 1260 struct node_type* v_prev; \ 1261 struct node_type* v_next 1267 #define VS_SEQUENCE_FIELDS() \ 1268 VS_TREE_NODE_FIELDS(VsSeq); \ 1274 VsMemStorage* storage; \ 1275 VsSeqBlock* free_blocks; \ 1278 #define VS_TYPE_NAME_SEQ "vs-sequence" 1279 #define VS_TYPE_NAME_SEQ_TREE "vs-sequence-tree" 1288 #define VS_SET_ELEM_FIELDS(elem_type) \ 1290 struct elem_type* next_free; 1292 typedef struct VsSetElem
1294 VS_SET_ELEM_FIELDS(VsSetElem)
1298 #define VS_SET_FIELDS() \ 1299 VS_SEQUENCE_FIELDS() \ 1300 VsSetElem* free_elems; \ 1303 typedef struct VsSet
1310 #define VS_SET_ELEM_IDX_MASK ((1 << 26) - 1) 1311 #define VS_SET_ELEM_FREE_FLAG (1 << (sizeof(int)*8-1)) 1314 #define VS_IS_SET_ELEM( ptr ) (((VsSetElem*)(ptr))->flags >= 0) 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) 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 1337 #define VS_NODE_SEQ 5 1338 #define VS_NODE_MAP 6 1339 #define VS_NODE_TYPE_MASK 7 1341 #define VS_NODE_TYPE(flags) ((flags) & VS_NODE_TYPE_MASK) 1344 #define VS_NODE_FLOW 8 1345 #define VS_NODE_USER 16 1346 #define VS_NODE_EMPTY 32 1347 #define VS_NODE_NAMED 64 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) 1360 #define VS_NODE_SEQ_SIMPLE 256 1361 #define VS_NODE_SEQ_IS_SIMPLE(seq) (((seq)->flags & VS_NODE_SEQ_SIMPLE) != 0) 1363 typedef struct VsString
int height
Image height in pixels.
char * imageData
Pointer to aligned image data.
int nChannels
Most of OpenCV functions support 1,2,3 or 4 channels.
int width
Image width in pixels.
void * imageId
Must be NULL.
int depth
Pixel depth in bits: VS_DEPTH_8U, VS_DEPTH_8S, VS_DEPTH_16S, VS_DEPTH_32S, VS_DEPTH_32F and VS_DEPTH_...
int imageSize
Image data size in bytes (==image->height*image->widthStep in case of interleaved data)
int alphaChannel
Ignored by OpenCV.
struct _VsImage * maskROI
Must be NULL.
char * imageDataOrigin
Pointer to very origin of image data (not necessarily aligned) - needed for correct deallocation.
struct _VsROI * roi
Image ROI.
int dataOrder
0 - interleaved color channels, 1 - separate color channels.
int origin
0 - top-left origin, 1 - bottom-left origin (Windows bitmaps style).
int widthStep
Size of aligned image row in bytes.
struct _VsTileInfo * tileInfo
Must be NULL.
int align
Alignment of image rows (4 or 8).