Background: there are now n cvmat matrices, each of which is a 1 * m row vector, that is, each cvmat represents a sample feature vector.
Now we need to apply for an N * M matrix, that is, a matrix of N rows and M columns. Each row represents a sample feature vector. The dimension of the feature vector is M. This problem is also entangled in my multi-day matrix merging problem.
Solution:
Cvmat * palm = (cvmat *) cvload (PATH); // obtain a row vector.
Mat tempmat = MAT (Palm, true); // convert cvmat to mat
Mat dsttemp = M. Row (n); // m is the target matrix N * m
Tempmat. copyto (dsttemp );//
How can I check the m value? I can say cout <m on the Internet, but I am not successful on my computer. I don't know what's going on.
My own method:
Const float * pdata = M. PTR <float> (1); // This is the value of the second row. If you view the first row, change it to <float> (0)
For (INT I = 0; I <M. Cols; I ++)
Cout <pdata [I] <Endl;
Now, the problem is solved perfectly !!! Nnd, let me study for a few days.
Refer:
(1) http://stackoverflow.com/questions/8005627/opencv-2-3-copyto-function-not-working-as-it-was-in-2-2
(2) http://hi.baidu.com/%BE%B2%C7%C4%C7%C4%B5%D8%B0% AE %D7%C5%C4%E3/blog/item/509b7d198c12742734fa417e.html#0 I follow this method, error:
Error: no matching function for call to 'cv: mat: copyto (CV: mat) '(3) http://www.opencv.org.cn/forum/viewtopic.php? P = 2987 is implemented based on the cvmat type. It is too troublesome. I have no experiment. Let me know the result!