How to save matrix 2d to array
I have 2 matrix, egnvecx and egnvecy. egnvecx :
[0.52065742, 0.39711261, 0.75578946, 0;
-0.42713234, 0.88765043, -0.17214788, 0;
0, 0, 0, 1;
0.73923874, 0.233192, -0.63178128, 0]
egnvecy :
[1, 0, 0, 0;
0, 1, 0, 0;
0, 0, 1, 0;
0, 0, 0, 1]
Then, I will save this matrix into array it contain x and y. But I dont know how the step is. this the code will be error.
Mat data_pts = Mat(4,4, CV_32F);
for (int i = 0; i < data_pts.rows; ++i)
{
for (int x=0; x<data_pts.cols; x++){
data_pts.at<float>(i,x) = egnvecx.ptr<float>(i,x);
data_pts.at<float>(i,x) = egnvecy.ptr<float>(i,x);
}
}
cout << data_pts;
thank you :))
Can you help us ? What is error message?
do you want to merge your 2 4x4x1 Matrices into a single 4x4x2 one ?
yes, I wan to merge this 2 matrices