#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <iostream>
#include <sstream>
using namespace std;
using namespace cv;
int main(){
Mat mat{ 3, 4, CV_16UC4, Scalar_ < uchar > {1, 2, 3, 4} };
int dims[3] = { 3, 3, 3 };
Mat src(3, dims, CV_16SC2, Scalar_<short>(1, 2));
cout << mat.rows << endl;
cout << mat.cols << endl;
cout << mat.channels() << endl;
cout << mat.dims << endl;
cout << mat.depth() << endl;
cout << mat.elemSize() << endl;//一个元素的大小,这里的一个元素是n通道的累加
cout << mat.elemSize1() << endl;//具体来说,就一个一个元素中的一个通道的字节数
cout << mat.type() << endl;
cout << src.step[0] << endl;//一个面的大小,3*3*(16/8)*2
cout << src.step[1] << endl;//一行的大小 3*(16/8)*2
cout << src.step[2] << endl;//一个元素的大小(16/2)*2
getchar();
return 0;
}
opencv学习:mat的属性笔记
最新推荐文章于 2024-07-22 17:00:50 发布