Slicing 3D array into 2D arrays

You can try to reduce dimensionality using data pointer, like this:

m20 = Mat(Size(2, 2), CV_32F, m20.data);
m21 = Mat(Size(2, 2), CV_32F, m21.data);
1 Like