?? cxtypes.h
字號:
#define CV_8SC1 CV_MAKETYPE(CV_8S,1)
#define CV_8SC2 CV_MAKETYPE(CV_8S,2)
#define CV_8SC3 CV_MAKETYPE(CV_8S,3)
#define CV_8SC4 CV_MAKETYPE(CV_8S,4)
#define CV_16UC1 CV_MAKETYPE(CV_16U,1)
#define CV_16UC2 CV_MAKETYPE(CV_16U,2)
#define CV_16UC3 CV_MAKETYPE(CV_16U,3)
#define CV_16UC4 CV_MAKETYPE(CV_16U,4)
#define CV_16SC1 CV_MAKETYPE(CV_16S,1)
#define CV_16SC2 CV_MAKETYPE(CV_16S,2)
#define CV_16SC3 CV_MAKETYPE(CV_16S,3)
#define CV_16SC4 CV_MAKETYPE(CV_16S,4)
#define CV_32SC1 CV_MAKETYPE(CV_32S,1)
#define CV_32SC2 CV_MAKETYPE(CV_32S,2)
#define CV_32SC3 CV_MAKETYPE(CV_32S,3)
#define CV_32SC4 CV_MAKETYPE(CV_32S,4)
#define CV_32FC1 CV_MAKETYPE(CV_32F,1)
#define CV_32FC2 CV_MAKETYPE(CV_32F,2)
#define CV_32FC3 CV_MAKETYPE(CV_32F,3)
#define CV_32FC4 CV_MAKETYPE(CV_32F,4)
#define CV_64FC1 CV_MAKETYPE(CV_64F,1)
#define CV_64FC2 CV_MAKETYPE(CV_64F,2)
#define CV_64FC3 CV_MAKETYPE(CV_64F,3)
#define CV_64FC4 CV_MAKETYPE(CV_64F,4)
#define CV_AUTO_STEP 0x7fffffff
#define CV_WHOLE_ARR cvSlice( 0, 0x3fffffff )
#define CV_MAT_CN_MASK ((CV_CN_MAX - 1) << CV_CN_SHIFT)
#define CV_MAT_CN(flags) ((((flags) & CV_MAT_CN_MASK) >> CV_CN_SHIFT) + 1)
#define CV_MAT_DEPTH_MASK (CV_DEPTH_MAX - 1)
#define CV_MAT_DEPTH(flags) ((flags) & CV_MAT_DEPTH_MASK)
#define CV_MAT_TYPE_MASK (CV_DEPTH_MAX*CV_CN_MAX - 1)
#define CV_MAT_TYPE(flags) ((flags) & CV_MAT_TYPE_MASK)
#define CV_MAT_CONT_FLAG_SHIFT 9
#define CV_MAT_CONT_FLAG (1 << CV_MAT_CONT_FLAG_SHIFT)
#define CV_IS_MAT_CONT(flags) ((flags) & CV_MAT_CONT_FLAG)
#define CV_IS_CONT_MAT CV_IS_MAT_CONT
#define CV_MAT_TEMP_FLAG_SHIFT 10
#define CV_MAT_TEMP_FLAG (1 << CV_MAT_TEMP_FLAG_SHIFT)
#define CV_IS_TEMP_MAT(flags) ((flags) & CV_MAT_TEMP_FLAG)
#define CV_MAGIC_MASK 0xFFFF0000
#define CV_MAT_MAGIC_VAL 0x42420000
#define CV_TYPE_NAME_MAT "opencv-matrix"
typedef struct CvMat
{
int type;
int step;
/* for internal use only */
int* refcount;
union
{
uchar* ptr;
short* s;
int* i;
float* fl;
double* db;
} data;
#ifdef __cplusplus
union
{
int rows;
int height;
};
union
{
int cols;
int width;
};
#else
int rows;
int cols;
#endif
}
CvMat;
#define CV_IS_MAT_HDR(mat) \
((mat) != NULL && (((const CvMat*)(mat))->type & CV_MAGIC_MASK) == CV_MAT_MAGIC_VAL)
#define CV_IS_MAT(mat) \
(CV_IS_MAT_HDR(mat) && ((const CvMat*)(mat))->data.ptr != NULL)
#define CV_IS_MASK_ARR(mat) \
(((mat)->type & (CV_MAT_TYPE_MASK & ~CV_8SC1)) == 0)
#define CV_ARE_TYPES_EQ(mat1, mat2) \
((((mat1)->type ^ (mat2)->type) & CV_MAT_TYPE_MASK) == 0)
#define CV_ARE_CNS_EQ(mat1, mat2) \
((((mat1)->type ^ (mat2)->type) & CV_MAT_CN_MASK) == 0)
#define CV_ARE_DEPTHS_EQ(mat1, mat2) \
((((mat1)->type ^ (mat2)->type) & CV_MAT_DEPTH_MASK) == 0)
#define CV_ARE_SIZES_EQ(mat1, mat2) \
((mat1)->height == (mat2)->height && (mat1)->width == (mat2)->width)
#define CV_IS_MAT_CONST(mat) \
(((mat)->height|(mat)->width) == 1)
/* 0x3a50 = 11 10 10 01 01 00 00 ~ array of log2(sizeof(arr_type_elem)) */
#define CV_ELEM_SIZE(type) \
(CV_MAT_CN(type) << ((((sizeof(size_t)/4+1)*16384|0x3a50) >> CV_MAT_DEPTH(type)*2) & 3))
/* inline constructor. No data is allocated internally!!!
(use together with cvCreateData, or use cvCreateMat instead to
get a matrix with allocated data */
CV_INLINE CvMat cvMat( int rows, int cols, int type, void* data CV_DEFAULT(NULL));
CV_INLINE CvMat cvMat( int rows, int cols, int type, void* data )
{
CvMat m;
assert( (unsigned)CV_MAT_DEPTH(type) <= CV_64F );
type = CV_MAT_TYPE(type);
m.type = CV_MAT_MAGIC_VAL | CV_MAT_CONT_FLAG | type;
m.cols = cols;
m.rows = rows;
m.step = rows > 1 ? m.cols*CV_ELEM_SIZE(type) : 0;
m.data.ptr = (uchar*)data;
m.refcount = NULL;
return m;
}
#define CV_MAT_ELEM_PTR_FAST( mat, row, col, pix_size ) \
(assert( (unsigned)(row) < (unsigned)(mat).rows && \
(unsigned)(col) < (unsigned)(mat).cols ), \
(mat).data.ptr + (size_t)(mat).step*(row) + (pix_size)*(col))
#define CV_MAT_ELEM_PTR( mat, row, col ) \
CV_MAT_ELEM_PTR_FAST( mat, row, col, CV_ELEM_SIZE((mat).type) )
#define CV_MAT_ELEM( mat, elemtype, row, col ) \
(*(elemtype*)CV_MAT_ELEM_PTR_FAST( mat, row, col, sizeof(elemtype)))
CV_INLINE double cvmGet( const CvMat* mat, int row, int col );
CV_INLINE double cvmGet( const CvMat* mat, int row, int col )
{
int type;
type = CV_MAT_TYPE(mat->type);
assert( (unsigned)row < (unsigned)mat->rows &&
(unsigned)col < (unsigned)mat->cols );
if( type == CV_32FC1 )
return ((float*)(mat->data.ptr + (size_t)mat->step*row))[col];
else
{
assert( type == CV_64FC1 );
return ((double*)(mat->data.ptr + (size_t)mat->step*row))[col];
}
}
CV_INLINE void cvmSet( CvMat* mat, int row, int col, double value );
CV_INLINE void cvmSet( CvMat* mat, int row, int col, double value )
{
int type;
type = CV_MAT_TYPE(mat->type);
assert( (unsigned)row < (unsigned)mat->rows &&
(unsigned)col < (unsigned)mat->cols );
if( type == CV_32FC1 )
((float*)(mat->data.ptr + (size_t)mat->step*row))[col] = (float)value;
else
{
assert( type == CV_64FC1 );
((double*)(mat->data.ptr + (size_t)mat->step*row))[col] = (double)value;
}
}
CV_INLINE int cvCvToIplDepth( int type )
{
int depth = CV_MAT_DEPTH(type);
return CV_ELEM_SIZE(depth)*8 | (depth == CV_8S || depth == CV_16S ||
depth == CV_32S ? IPL_DEPTH_SIGN : 0);
}
/****************************************************************************************\
* Multi-dimensional dense array (CvMatND) *
\****************************************************************************************/
#define CV_MATND_MAGIC_VAL 0x42430000
#define CV_TYPE_NAME_MATND "opencv-nd-matrix"
#define CV_MAX_DIM 32
#define CV_MAX_DIM_HEAP (1 << 16)
typedef struct CvMatND
{
int type;
int dims;
int* refcount;
union
{
uchar* ptr;
float* fl;
double* db;
int* i;
short* s;
} data;
struct
{
int size;
int step;
}
dim[CV_MAX_DIM];
}
CvMatND;
#define CV_IS_MATND_HDR(mat) \
((mat) != NULL && (((const CvMatND*)(mat))->type & CV_MAGIC_MASK) == CV_MATND_MAGIC_VAL)
#define CV_IS_MATND(mat) \
(CV_IS_MATND_HDR(mat) && ((const CvMatND*)(mat))->data.ptr != NULL)
/****************************************************************************************\
* Multi-dimensional sparse array (CvSparseMat) *
\****************************************************************************************/
#define CV_SPARSE_MAT_MAGIC_VAL 0x42440000
#define CV_TYPE_NAME_SPARSE_MAT "opencv-sparse-matrix"
struct CvSet;
typedef struct CvSparseMat
{
int type;
int dims;
int* refcount;
struct CvSet* heap;
void** hashtable;
int hashsize;
int valoffset;
int idxoffset;
int size[CV_MAX_DIM];
}
CvSparseMat;
#define CV_IS_SPARSE_MAT_HDR(mat) \
((mat) != NULL && \
(((const CvSparseMat*)(mat))->type & CV_MAGIC_MASK) == CV_SPARSE_MAT_MAGIC_VAL)
#define CV_IS_SPARSE_MAT(mat) \
CV_IS_SPARSE_MAT_HDR(mat)
/**************** iteration through a sparse array *****************/
typedef struct CvSparseNode
{
unsigned hashval;
struct CvSparseNode* next;
}
CvSparseNode;
typedef struct CvSparseMatIterator
{
CvSparseMat* mat;
CvSparseNode* node;
int curidx;
}
CvSparseMatIterator;
#define CV_NODE_VAL(mat,node) ((void*)((uchar*)(node) + (mat)->valoffset))
#define CV_NODE_IDX(mat,node) ((int*)((uchar*)(node) + (mat)->idxoffset))
/****************************************************************************************\
* Histogram *
\****************************************************************************************/
typedef int CvHistType;
#define CV_HIST_MAGIC_VAL 0x42450000
#define CV_HIST_UNIFORM_FLAG (1 << 10)
/* indicates whether bin ranges are set already or not */
#define CV_HIST_RANGES_FLAG (1 << 11)
#define CV_HIST_ARRAY 0
#define CV_HIST_SPARSE 1
#define CV_HIST_TREE CV_HIST_SPARSE
#define CV_HIST_UNIFORM 1 /* should be used as a parameter only,
it turns to CV_HIST_UNIFORM_FLAG of hist->type */
typedef struct CvHistogram
{
int type;
CvArr* bins;
float thresh[CV_MAX_DIM][2]; /* for uniform histograms */
float** thresh2; /* for non-uniform histograms */
CvMatND mat; /* embedded matrix header for array histograms */
}
CvHistogram;
#define CV_IS_HIST( hist ) \
((hist) != NULL && \
(((CvHistogram*)(hist))->type & CV_MAGIC_MASK) == CV_HIST_MAGIC_VAL && \
(hist)->bins != NULL)
#define CV_IS_UNIFORM_HIST( hist ) \
(((hist)->type & CV_HIST_UNIFORM_FLAG) != 0)
#define CV_IS_SPARSE_HIST( hist ) \
CV_IS_SPARSE_MAT((hist)->bins)
#define CV_HIST_HAS_RANGES( hist ) \
(((hist)->type & CV_HIST_RANGES_FLAG) != 0)
/****************************************************************************************\
* Other supplementary data type definitions *
\****************************************************************************************/
/*************************************** CvRect *****************************************/
typedef struct CvRect
{
int x;
int y;
int width;
int height;
}
CvRect;
CV_INLINE CvRect cvRect( int x, int y, int width, int height );
CV_INLINE CvRect cvRect( int x, int y, int width, int height )
{
CvRect r;
r.x = x;
r.y = y;
r.width = width;
r.height = height;
return r;
}
CV_INLINE IplROI cvRectToROI( CvRect rect, int coi CV_DEFAULT(0));
CV_INLINE IplROI cvRectToROI( CvRect rect, int coi )
{
IplROI roi;
roi.xOffset = rect.x;
roi.yOffset = rect.y;
roi.width = rect.width;
roi.height = rect.height;
roi.coi = coi;
return roi;
}
CV_INLINE CvRect cvROIToRect( IplROI roi );
CV_INLINE CvRect cvROIToRect( IplROI roi )
{
return cvRect( roi.xOffset, roi.yOffset, roi.width, roi.height );
}
/*********************************** CvTermCriteria *************************************/
#define CV_TERMCRIT_ITER 1
#define CV_TERMCRIT_NUMBER CV_TERMCRIT_ITER
#define CV_TERMCRIT_EPS 2
typedef struct CvTermCriteria
{
int type; /* may be combination of
CV_TERMCRIT_ITER
CV_TERMCRIT_EPS */
int max_iter;
double epsilon;
}
CvTermCriteria;
CV_INLINE CvTermCriteria cvTermCriteria( int type, int max_iter, double epsilon );
CV_INLINE CvTermCriteria cvTermCriteria( int type, int max_iter, double epsilon )
{
CvTermCriteria t;
t.type = type;
t.max_iter = max_iter;
t.epsilon = (float)epsilon;
return t;
}
/******************************* CvPoint and variants ***********************************/
typedef struct CvPoint
{
int x;
int y;
}
CvPoint;
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -