Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

GetRow returns Mat, clone or original data?

Hello,

Are these two pieces of code equivalent? SDMat and BMat are the rows of the matrices SD and B. SDMat and BMat interact, thus changing the original SD and B matrices.

Old version

for(i = 0; i < __shape.nModes()+4; i++) { for(j = 0; j < __texture.nModes(); j++) { cvGetRow(SD, &SDMat, i); cvGetRow(B, &BMat, j); cvScaleAdd(&BMat, cvScalar(-cvmGet(V,i,j)), &SDMat, &SDMat); } }

New version.

for(i = 0; i < __shape.nModes()+4; i++) { for(j = 0; j < __texture.nModes(); j++) { SDMat = SD.row(i); BMat = B.row(j); cv::scaleAdd(BMat, -V.at<double>(i,j), SDMat, SDMat); } }