3、r(intc=0;c<3;c++)matrixandascalar.KeyOpenCVClassesdyImage.at(y,x)[c]=Example.Alphacompositingfunction:Point_Template2Dpointclasssaturate_cast(voidalphaCompose(constMat&rgba1,Point3_Template3DpointclassnextRow[x][c]-prevRow[x][c]);constMat&rgba2,M
4、at&rgba_dest)Size_Templatesize(width,height)class}{VecTemplateshortvectorclassMat_::iteratorit=image.begin(),Mata1(rgba1.size(),rgba1.type()),ra1;MatxTemplatesmallmatrixclassitEnd=image.end();Mata2(rgba2.size(),rgba2.type());Scalar4-elemen
5、tvectorfor(;it!=itEnd;++it)intmixch[]={3,0,3,1,3,2,3,3};RectRectangle(*it)[1]^=255;mixChannels(&rgba1,1,&a1,1,mixch,4);RangeIntegervaluerangemixChannels(&rgba2,1,&a2,1,mixch,4);Mat2Dormulti-dimensionaldensearraysubtract(Scalar::all(255),a1,ra1);(canbeusedtosto
6、rematrices,images,MatrixManipulations:Copying,bitwise_or(a1,Scalar(0,0,0,255),a1);histograms,featuredescriptors,voxelbitwise_or(a2,Scalar(0,0,0,255),a2);volumesetc.)Shuing,PartAccessmultiply(a2,ra1,a2,1./255);SparseMatMulti-dimensionalsparsearraysrc.copyTo(ds
7、t)Copymatrixtoanotheronemultiply(a1,rgba1,a1,1./255);PtrTemplatesmartpointerclasssrc.convertTo(dst,type,scale,shift)Scaleandconverttomultiply(a2,rgba2,a2,1./255);MatrixBasicsanotherdatatypeadd(a1,a2,rgba_dest);m.clone()Makedeepcopyofamatrix}Createamatrixm.resh
8、ape(nch,nrows)Changematrixdimensionsand/ornum-Matimage(240,320,CV_8UC3);sum(),mean(),meanStdDev(),norm(),countNonZero(),berofchannelswithoutcopyingdata[Re]allocateapre-declaredmat