MATLAB:将图像分解为图像块,然后撤消此操作

时间:2015-10-19 15:41:46

标签: matlab reshape permute

我使用以下代码行将图像分解为块(子区域):

srhblocks = reshape(permute(reshape(im2, ysrh, ynum, xsrh, xnum), [1 3 2 4]), ysrh, xsrh, xnum * ynum);

x / ysrh和x / ynum是长度和块数x / y

然后我对每个图像块执行操作(每个块输出一个数字),然后想要撤消上述重塑。你如何表现与上述相反?感谢

1 个答案:

答案 0 :(得分:0)

%stitch together search image blocks
srhblocksall = num2cell(srhblocks, [1 2]); %split the stack into a cell array 
srhblocksall = reshape(srhblocksall, ynum, xnum); %reshape the tiles into their final position.
srhblocksall = cell2mat(srhblocksall); %convert to matrix

上面的代码适用于我的应用程序。