目录
-
完整Demo:
https://github.com/youhengchan/learn_opencv4/tree/master/02-Mat
-
参数解释
https://docs.opencv.org/master/d6/d6d/tutorial_mat_the_basic_image_container.html
官网的tutorial中提到了一种手动生成图像的办法
其中有一个参数CV_8UC3
Mat M(2, 2, CV_8UC3, Scalar(0, 0, 255));
cout << "M = " << endl << " " << M << endl << endl;
CV_[The number of bits per item][Signed or Usigned][Type Prefix]C[The channel number]
CV_ 8 U C 3
对比:
The number of bits per item = 8,8位表示一种颜色
Signed or Usigned = U
Type Prefix = void
The channel number = 3 三通道,不带透明度(transparency),带透明度需要加上通道alpha(A)
生成后,发现是一个红色的小块(一共只有2×2 = 4个像素)