方法一:
Mat src = imread(“1.jpg”);
Mat dst = Mat(src.rows,src.cols, CV_8UC3, Scalar(255, 255, 255));
opencv中的定义:
Mat(int _rows, int _cols, int _type, const Scalar& _s)
方法二:
Mat dst = Mat(Size(src.cols,src.rows), CV_8UC3, Scalar(255, 255, 255));
注: Size(cols, rows) . In the Size() constructor, the number of rows and the number of columns go in the reverse order.
区别:用Size()和不用Size(),定义长度和宽度的顺序是相反的。