how to combine the blocks

1 次查看(过去 30 天)
Sharen H
Sharen H 2013-7-20
clc
clear all
x=
[2 3 4 5
2 3 4 5
1 2 3 4
1 2 3 4]
[r c]=size(x);
bs=2; % Block Size (8x8)
nob=(r/bs)*(c/bs); % Total number of 8x8 Blocks
% Dividing the image into 2x2 Blocks
kk=0;
for i=1:(r/bs)
for j=1:(c/bs)
Block(:,:,kk+j)=x((bs*(i-1)+1:bs*(i-1)+bs),(bs*(j-1)+1:bs*(j-1)+bs));
BlockM=Block(:,:,kk+j);
BlockMM=mean(BlockM(:));
Block(:,:,kk+j)=BlockMM
end
kk=kk+(r/bs);
end
i have divided the matrix into blocks of 2x2 size and i have stored it in Block(:,:,i) separately. can any one please help me to combine into original matrix thanks in advance

回答(0 个)

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by