Mat的运算:A和B是Mat类型,s是标量,a是double类型的标量
Mat C = (Mat_(3,3) << 0, -1, 0, -1, 5, -1, 0, -1, 0);
Mat M(2,2, CV_8UC3, Scalar(0,0,255));
int sz[3] = {2,2,2};
Mat L(3,sz, CV_8UC(1), Scalar::all(0));
M.create(4,4, CV_8UC(2));
Mat O = Mat::ones(2, 2, CV_32F);
Mat Z = Mat::zeros(3,3, CV_8UC1);
Mat RowClone = C.row(1).clone();
Mat R = Mat(3, 2, CV_8UC3);
randu(R, Scalar::all(0), Scalar::all(255));
加减、取负:A+B A-B A+s A-s s+A s-A -A
按元素相乘和相除:A.mul(B), A/B, alpha / A
矩阵乘法:A*B
转置:A.t()
矩阵的逆:A.inv()
按位进行逻辑运算:A & B A | B
按位最大和最小:min(A, B), max(A, B)
计算Mat的元素和:sum(A)
对Mat按元素求次幂:pow(src_mat, 2, dst_mat)
求Mat的特征值和特征向量:Mat eValuesMat;Mat eVectorsMat; eigen(myMat, eValuesMat, eVectorsMat);
阅读(4628) | 评论(0) | 转发(0) |