1. 程式人生 > >opencv Mat大小的初始化

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(),定義長度和寬度的順序是相反的。