Understanding of planes in NAryMatIterator

asked 2016-07-17 06:08:56 -0500

tischenkoalex gravatar image

I have 3-dimension matrix:

const int n_mat_size = 5;
const int n_mat_sz[] = { n_mat_size , n_mat_size, n_mat_size };
cv::Mat m1(3, n_mat_sz, CV_32FC1);

Now I'd like to iterate its planes and expect that it should be three two-dimensional matrices:

const cv::Mat* arrays[] = { &m1, 0 };
cv::Mat planes[3];
cv::NAryMatIterator it(arrays, planes);
std::cout << it.nplanes << ", " << it.planes[0].rows << ", " << it.planes[0].cols;

I expect to get output "3, 5, 5", but instead I get "1, 1, 125". Where is the slice of matrix?

edit retag flag offensive close merge delete