
#include <iostream>
#include <filesystem>
#include <string>
#include <windows.h>
#include <opencv2/opencv.hpp>
namespace fs = std::filesystem;
using namespace cv;
using namespace std;
int main()
{
// 行 列
Mat mat(400, 600, CV_8UC3);
int es = mat.elemSize();
int size = mat.rows * mat.cols * es;
// 连续遍历
for (int i = 0; i < size; i = i + 3) {
// 填充蓝色
mat.data[i] = 255; // B
mat.data[i + 1] = 0; // G
mat.data[i + 2] = 0; // R
}
imshow("mat new", mat);
waitKey(0);
destroyAllWindows();
return 0;
}