I'm trying to reshape a multidimensional array into the original image. I have split an image of 512x512 pixels in sub-matrices of 8x8 pixels using the great solution that I found in this question:
sub_images = permute(reshape(permute(reshape(i_image, size(i_image, 1), n, []), [2 1 3]), n, m, []), [2 1 3]);
in this case n=m=8 and sub_images is an array of 8x8x4096. Now the problem is that I want to come back to the original image avoiding a for loops but I don't understand how to do it. I know that exist the functions colfilt
or blockproc
but I can't use them. Any help is greatly appreciated!
Just do the reverse of what you used to reshape the original array. The permute commands stay the same (switching the first and second dimension), while the reshape commands go back up to 512