Reputation: 555
I want to use reshape()
function in matlab by calling the following self-defined function:
imgRgb = reshape(convertYuvToRgb(reshape(imgYuv, height*width, 3)), height, width, 3);
Here:
width=352
height=288
And imgYuv
is a 4D matrix.
However, the system gave me the following error message:
To RESHAPE the number of elements must not change.
Can any expert give me some tips?
Thanks!
Upvotes: 2
Views: 5805
Reputation:
For example, you cannot reshape a 2x4 matrix into a 3x3 matrix. One has 8 elements, the other 9. The warning that matlab has issued tells you that something like this has been tried.
You may think that the matrix is a different size than it is, but the proof is in the numbers. Check the actual sizes of these matrices. Count the elements. The matlab function numel will tell you how many elements are in a matrix, so you can compare directly.
Upvotes: 8