http://www.cnblogs.com/platero/archive/2012/09/02/2667326.html
创建矩阵:
- Mat M(7,7,CV_32FC2,Scalar(1,3));
- M.create(100,60,CV_8UC(15));
逐个元素的存取mat里面的值:
逐个存:取也是一样的
Mat img1(1000, 1000, CV_32F);
img1.at<float>(i,j) = 3.2f;
整个矩阵赋值:
- Mat A, C; // creates just the header parts
- A = imread(argv[1], CV_LOAD_IMAGE_COLOR); // here we’ll know the method used (allocate matrix) 直接导入图像
- Mat B(A); // Use the copy constructor 这两种赋值方法,只是复制了矩阵头
- C = A; // Assignment operator
- %真正的复制要用clone()和copyto()函数
直接将数据指针赋值给mat
- void process_video_frame(const unsigned char* pixels,
- int width, int height, int step)
- {
- Mat img(height, width, CV_8UC3, pixels, step);
- GaussianBlur(img, img, Size(7,7), 1.5, 1.5);
- }