how to combine the blocks

4 views (last 30 days)
Sharen H
Sharen H on 20 Jul 2013
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

Answers (0)

Categories

Find more on Modeling in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!