views:

29

answers:

1

Hey guys. 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, 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!

+5  A: 

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.

woodchips

related questions