Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

your current solution overwrites x with the y position, and do only keeps y. i think, you wanted to merge your arrays (like a zipper):

Mat_<float> x(4,4); x << 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;

Mat_<float> y(4,4); y << 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1;

Mat xy; Mat chn[2] = {x,y};

merge(chn,2,xy);

cerr << xy <<endl;< p="">

[0.52065742, 1, 0.39711261, 0, 0.75578946, 0, 0, 0; -0.42713234, 0, 0.88765043, 1, -0.17214788, 0, 0, 0; 0, 0, 0, 0, 0, 1, 1, 0; 0.73923874, 0, 0.233192, 0, -0.63178128, 0, 0, 1]

your current solution overwrites x with the y position, and do only keeps y. i think, you wanted to merge your arrays (like a zipper):

Mat_<float> x(4,4);
x << 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;

0;

Mat_<float> y(4,4); y << 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1;

1;

Mat xy; Mat chn[2] = {x,y};

{x,y}; merge(chn,2,xy);

merge(chn,2,xy);

cerr << xy <<endl;< p=""> <<endl;

[0.52065742, 1, 0.39711261, 0, 0.75578946, 0, 0, 0; -0.42713234, 0, 0.88765043, 1, -0.17214788, 0, 0, 0; 0, 0, 0, 0, 0, 1, 1, 0; 0.73923874, 0, 0.233192, 0, -0.63178128, 0, 0, 1]

1]

your current solution overwrites x with the y position, and do so only keeps y.

i think, you wanted to merge your arrays (like a zipper):

Mat_<float> x(4,4);
x << 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;

Mat_<float> y(4,4);
y << 1, 0, 0, 0,
  0, 1, 0, 0,
  0, 0, 1, 0,
  0, 0, 0, 1;

Mat xy;
Mat chn[2] = {x,y};

merge(chn,2,xy);

cerr << xy <<endl;


[0.52065742, 1, 0.39711261, 0, 0.75578946, 0, 0, 0;
 -0.42713234, 0, 0.88765043, 1, -0.17214788, 0, 0, 0;
 0, 0, 0, 0, 0, 1, 1, 0;
 0.73923874, 0, 0.233192, 0, -0.63178128, 0, 0, 1]