#include <iostream>
#include <opencv2/opencv.hpp>
#include <opencv2/core.hpp>
#include <opencv2/imgcodecs.hpp>
using namespace std;
using namespace cv;
const int dims = 3; // 维度定义为3
// 像素点 CV_64FC3 通道分量 64位float 最小内存单位 byte
int main()
{
int shape[] = { 4, 5, 6 }; // 面区间[0, 3), 行区间[0, 4), 列区间[0, 5)
Mat mat(dims, shape, CV_64FC3, cv::Scalar(1.2, 3.4, 5.6));
cout << "行数: mat.rows = " << mat.rows << endl;
cout << "列数: mat.cols = " << mat.cols << endl;
cout << "通道数:mat.channels() = " << mat.channels() << endl;
cout << "深度:mat.depth() == CV_64FC => 被定义为6" << endl;
cout << " mat.depth() = " << mat.depth() << endl;
cout << "Mat中像素点的总数: mat.total() = " << mat.total() << endl;
cout << "Mat中像素面数: mat.total(0, 1) = " << mat.total(0, 1) << endl;
cout << "像素面中的行数: mat.total(1, 2) = " << mat.total(1, 2) << endl;
cout << "像素面中的列数: mat.total(2, 3) = " << mat.total(2, 3) << endl;
cout << "像素点的字节数: mat.elemSize() = " << mat.elemSize() << endl;
cout << "通道分量的字节数: mat.elemSize1() = " << mat.elemSize1() << endl;
cout << "像素面的字节数: step[0] = " << mat.step[0] << endl; // 5 * 6 * 24 = 720
cout << "像素行的字节数: step[1] = " << mat.step[1] << endl; // 6 * 24 = 144
cout << "像素点的字节数:step[2] = " << mat.step[2] << endl; // 24
cout << "像素面中通道分量数:step1(0) = mat.step1(0) = " << mat.step1(0) << endl; // 5 * 3 * 6 = 90
cout << "像素行中通道分量数:step1(1) = mat.step1(1) = " << mat.step1(1) << endl; // 3 * 6 = 18
cout << "像素点中通道分量数:step1(2) = mat.step1(2) = " << mat.step1(2) << endl; // 3
return 0;
}