function img = image_reshape_inv(inImage,row,col)
% image_reshape(rand(2,9),6,3) %将窄图裁剪成宽图 512x512 -> 4096x64 -> 512x512
[m,n] = size(inImage);
a = reshape(inImage',n,row,[]);
b = permute(a,[2,1,3]);
c = reshape(b,row,col);
img = c;
function img = image_reshape(inImage,row,col)
% image_reshape(rand(2,9),6,3) %将宽图裁成短图,512x512 -> 4096x64
[m,n] = size(inImage);
a = reshape(inImage,m,col,[]);
b = permute(a,[2,1,3]);
c = reshape(b,col,row)';
img = c;
将四张图片拼成一张图
%图像转换成h*w*4的三维矩阵
figure;
subplot(2,2,1);imshow(src(:,:,1),[]);
subplot(2,2,2);imshow(src(:,:,2),[]);
subplot(2,2,3);imshow(src(:,:,3),[]);
subplot(2,2,4);imshow(src(:,:,4),[]);
figure(2);
%将图像转换成h*(w*4)的二维矩阵
b = permute(src,[2,3,1]);
d =reshape(b,2720*4,[]);
imshow(d',[]);%实现图像转换成h*(w*4)的二维矩阵
%将图像转换成h*2w*2的二维矩阵
e =reshape(d',2704,2720*2,[]);
f = permute(e,[1,3,2]);
%将图像转换成2h*2w的图像
g = reshape(f,2704*2,[]);
imshow(g,[])%输出结果