1 | initial version |
Hey there,
Lemme tell you one thing.
Be it reshape in MATLAB or reshape in OpenCV or reshape anywhere, the only rule to keep in mind is the number of elements in img (= rows * cols * numChannels) must be the same before and after Reshaping
(i.e. x.rows * x.cols * x.channels() must be equal to img.rows * img.cols * img.channels() ).
No inclusion, no exclusion. If that's not possible then reshape cant be done.
It is readily available for 2D Mat with data in channels in OpenCV (http://docs.opencv.org/modules/core/doc/basic_structures.html#mat-reshape) and i am afraid that it is not extended to n dimension Mat yet (though N-D Mat is supported in OpenCV)
And looks like you are doing it right (as long as you take care of that condition mentioned :) )
Hope this helps. Good Luck with your project.
Regards,
Prasanna