using namespace cv;
2、Mat的声明
Mat m=Mat(rows, cols, type);
Mat m=Mat(Size(width,height), type);
Mat A=Mat(3,4,CV_32FC1);
Mat B=Mat(4,3,CV_32FC1);
3、Mat赋值
vectorv;//suppose it is already
full
Mat
m1=Mat(v,true);//boolean value true is necessary in
order to copy data from v to m1
CvMat
*p1=====??
Mat
m2=Mat(p1);
4、Mat之间运算
MatC=2*A*B;
Mat C=C.inv();//Now C is its own inverse
matrix
Mat D=A.t();//D is the transposed matrix of
A
Mat a=Mat(4,1, CV_32FC3);//a is 4x1, 3
channels
Mat b=a.reshape(1);//b is 4x3, 1
channel
5、单通道Mat元素读写
Mat a=Mat(4,3, CV_32FC1);
floatelem_a=a.at(i,j);//access element aij, with i from 0 to
rows-1 and j f