image.type()与image.depth()的区别。
type返回的是a metrix element type,即元素的类型,如:CV_8UC3;函数
depth()返回的是the depth of a matrix element,即矩阵的深度,如CV_8UC。element
区别在于depth没有通道的概念。构造函数
要注意一点是:im
C++: Mat::Mat(Sizesize, int type)(Mat的构造函数)img
在建立一个mat时,
Mat img(size(400,200), CV_8UC1);//建立一个400*200的单通道的深度为8uchar的矩阵。
也能够这样写:Mat img(size(400,200), CV_8U);
若是省略通道数,默认是单通道的状况。