Mat对象是Opencv2.0之后引进的图像数据结构。可以理解为一个包含所有强度值的像素点矩阵,另外包含其他信息(宽,高,类型,纬度,大小,深度等)。自动分配内存,不存在内存泄漏问题,是面向对象的数据结构。分为两个部分:头部和数据部分。
构造函数 | 常用方法 | 常用方法介绍 |
---|---|---|
Mat() | void copyTo(Mat outputImg) | 复制一个相同的Mat对象,两者互不相关 |
Mat(int rows,int cols,int type) | void convertTo(Mat dst,int type) | 改变输入图像的类型 |
Mat(Size size,int type) | Mat clone() | 和copyTo()类似,但比copyTo()慢 |
Mat(int rows,int cols,int type,const Scalar &s) | int channels() | 返回Mat对象的通道数 |
Mat(Size size,int type,const Scalar &s) | int depth() | 返回Mat对象的像素点属性 |
Mat(int ndims,const int *sizes,int type) | bool empty() | 判断是否为空 |
Mat(int ndims,const int *sizes,int type,const Scalar &s) | uchar* ptr(i) | 访问Mat对象矩阵的一行 |
…… | …… | …… |