Opencv笔记(1) 命名规则数据结构(CvMat,...)
2015-06-08 16:45
411 查看
网上搜索了很多,检查中发现的信息劣势,检查源代码同Cv为类的开始。包含详细的数据不(仅存储指针)CvMat
typedef struct CvMat { int type; int step; /* for internal use only */ int* refcount; int hdr_refcount; union { uchar* ptr; short* s; int* i; float* fl; double* db; } data; <pre name="code" class="cpp">#ifdef __cplusplus union { int rows; int height; }; union { int cols; int width; };#else int rows; int cols;#endif}CvMat;
<pre name="code" class="cpp">CV_INLINE CvMat cvMat( int rows, int cols, int type, void* data CV_DEFAULT(NULL)){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 = m.cols*CV_ELEM_SIZE(type);m.data.ptr = (uchar*)data;m.refcount = NULL;m.hdr_refcount = 0;return m;}
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*)(void*)(mat->data.ptr + (size_t)mat->step*row))[col]; else { assert( type == CV_64FC1 ); return ((double*)(void*)(mat->data.ptr + (size_t)mat->step*row))[col]; }}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*)(void*)(mat->data.ptr + (size_t)mat->step*row))[col] = (float)value; else { assert( type == CV_64FC1 ); ((double*)(void*)(mat->data.ptr + (size_t)mat->step*row))[col] = (double)value; }}
typedef struct CvMatND{ int type; int dims; int* refcount; int hdr_refcount; union { uchar* ptr; float* fl; double* db; int* i; short* s; } data; struct { int size; int step; } dim[CV_MAX_DIM];}CvMatND;
/* Basic element of the file storage - scalar or collection: */typedef struct CvFileNode{ int tag; struct CvTypeInfo* info; /* type information (only for user-defined object, for others it is 0) */ union { double f; /* scalar floating-point number */ int i; /* scalar integer number */ CvString str; /* text string */ CvSeq* seq; /* sequence (ordered collection of file nodes) */ CvFileNodeHash* map; /* map (collection of named file nodes) */ } data;}CvFileNode;
相关文章推荐
- 9. C#数据结构与算法 -- 线性存储结构(线性表之顺序表,动态数组和泛型实现)
- 数据结构和算法学习五,之查找
- Redis数据结构总结
- 8. C#数据结构与算法 -- 线性存储结构(线性表之顺序表,数组实现)
- HDU1394
- 简单数据结构之顺序表(C++ vector 实现)
- [综合面试] 牛人整理分享的面试知识:操作系统、计算机网络、设计模式、Linux编程,数据结构总结(转)
- 数据结构和算法学习四,之内存
- 数据结构系列之基数排序
- HDU 5266 pog loves szh III (线段树+在线LCA转RMQ)
- 统计字符串中每个字母出现的次数。
- java数据结构和算法------快速排序
- java数据结构和算法------选择排序
- 数据结构和算法学习三,之递归和堆栈
- 数据结构和算法学习二,之循环和递归
- 数据结构和算法学习一,开篇
- 数据结构算法代码实现——线性表的定义(一)
- 简单数据结构之顺序表(C++ 引用传递实现)
- 数据结构和算法-005 数组排序 二分法检索
- To_10_r_100_1---N个孩子站成一排,给每个人设定一个权重(已知)。按照如下的规则分配糖果