直接键入行列数和用Size定义:
#include <opencv2/opencv.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <iostream>
using namespace cv;
using namespace std;
int main()
{
Mat M(3,2,CV_8UC1,1);
cout<<"M="<<M<<endl;
Mat Z(Size(3,2),CV_8UC1,1);
cout<<"Z="<<Z<<endl;
}
结果如下: