0

I simply want to set the elements of a matrix to a specific value, without doing deep or even shallow copies.

As far as I’ve understood

myMat = Mat::ones(rows, cols, CV_32SC1)*10;

will allocate space on disk for a new matrix (same data type and dimension in this case), set values, release old data and then make myMat point to the new data. Instead

myMat = 10;

will just set values to the original data, without new allocation and release. It is equivalent to

myMat.setTo(10);

which in turn corresponds to old style:

cvSet(myMat, cvScalar(0));

Am I wrong in some point?

bjou
  • 1,107
  • 1
  • 7
  • 19
Koleey
  • 113
  • 1
  • 1
  • 5

0 Answers0