opencv Mat大小的初始化

方法一:
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(),定义长度和宽度的顺序是相反的。

猜你喜欢

转载自blog.csdn.net/weixin_43081805/article/details/84380271