CvMat是Struct,下面是定义:
CvMat
多通道矩阵
typedef struct CvMat
{
int type; /* CvMat 标识 (CV_MAT_MAGIC_VAL), 元素类型和标记 */
int step; /* 以字节为单位的行数据长度*/
int* refcount; /* 数据引用计数 */
union
{
uchar* ptr;
short* s;
int* i;
float* fl;
double* db;
} data; /* data 指针 */
#ifdef __cplusplus
union
{
int rows;
int height;
};
union
{
int cols;
int width;
};
#else
int rows; /* 行数 */
int cols; /* 列数*/
#endif
} CvMat;
cv::Mat是OpenCV中的一个类,包含很多函数,可以用来初始化对象并且可以进行很多操作。
CvMat cvMat( int rows, int cols, int type, void* data=NULL );
rows
矩阵行数
cols
列数.
type
元素类型(见CreateMat).
data
可选的分配给矩阵头的数据指针 .
关于cv::Mat内存泄露问题,参照:http://blog.csdn.net/andkobe/article/details/6185973