OpencvとC++でMatを作成する方法
#include
#include
#include
#include
using namespace cv;
using namespace std;
int main()
{
Mat M(2, 2, CV_8UC3, Scalar(0, 0, 255));
cout << "M = " << endl << M << endl;
Mat M;
M.create(4, 4, CV_8UC(2));
cout << "M = " << endl << M << endl;
Mat M = (Mat_(3, 3) << 0, 1, 2, 3, 4, 5, 6, 7, 8);
cout << "M = " << endl << M << endl;
Mat e = Mat::eye(4, 4, CV_64F);
Mat o = Mat::ones(2, 2, CV_32F);
Mat z = Mat::zeros(3, 3, CV_8UC1);
system("pause");
return 1;
}