opencv matrix operations (b)

Seven Ways to explicitly create a matrix Mat

1. Mat () constructor creates

// parameters: the number of rows, columns, and number of channels of data types, data of each block
// Data type and number of channels: CV_ [bits] [Are Signed] [data type] C [channels]
Mat m(288,288,CV_8UC3,Scalar(0,0,255));

2. The use of multi-dimensional Mat () constructor creates

Create a three-dimensional matrix, set the size of each dimension
int s[3]={2,2,2};
Mat m1(3,s,CV_8UC3,Scalar(0,0,255));

3.create function to create

Food m2;
m2.create(2,2,CV_8UC(2));

  

Guess you like

Origin www.cnblogs.com/navysummer/p/12323018.html