Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

if it really is as in your example above, it would be a simple:

Mat C = A.reshape(3); // 3rd dimension -> channels

if you have seperate "planes", like:

const int sizes[3] = {3, 50, 50};
cv::Mat A(3, sizes, CV_64F);

then it needs a different procedure:

vector<Mat> chn = {
     Mat(50,50,CV_64F, A.ptr<double>(0)),
     Mat(50,50,CV_64F, A.ptr<double>(1)),
     Mat(50,50,CV_64F, A.ptr<double>(2))
};

Mat C;
merge(chn, C);