Reply by bush...@yahoo.com October 30, 20072007-10-30
Hi All,

I have to make a deblocking filter in matlab for MPEG-4 video. For it I take frames from the video and and using in matlab. the frame size is 144x176.My first step is to find the activity across the 8x8 boundary blocks in the image. and then classify the block as smooth,complex region.
for that I first convert image into gray and then taking the 8x8 blocks, then on blocks i apply my formula of activity.Coding is as follows

%Reading Frames
f_204=imread('foreman_204.bmp');
figure,imshow(f_204);title('Frame No. 204');

% Take gray image

gf=rgb2gray(f_204);
figure, imshow(gf);title('Frame 204 converted into gray');

%Selecting 8x8 block of the image

b1=gf(1:8, 1:8); %gf(row,col);
figure, imshow(b1); title('1st block');

b2=gf(1:8, 9:16);
figure, imshow(b2); title('2nd block');

b3=gf(9:16, 1:8);
figure, imshow(b3); title('3rd block');

b4=gf(9:16, 9:16);
figure, imshow(b4); title('4th block');

%%%% setting the value of threshold T1 and T2
T1=2;
T2=3;

%Finding Activity A(v)

%%%%%%%%%%%%%%%% ACTIVITY OF BLOCK # 1 %%%%%%%%%%%%%%%%%%%%%%%%%

%Activity across vertical block boundary of block#1 and blcok#2

for i=1:8

v1=double(b1(i,6)); %from 1st 8x8 block
v2=double(b1(i,7));
v3=double(b1(i,8));
v4=double(b2(i,1)); %from 2nd 8x8 block
v5=double(b2(i,2));
v6=double(b2(i,3));

avc12(i)tivity(v1,v2,v3,v4,v5,v6);

if avc12(i) s1=avc12(i);
%% Smooth region
elseif avc12(i)>T2
s2=avc12(i);
%%complex region
else
s3=avc12(i);
%% intermediate region
end

end

now the problem is I have to calculate the activity of the whole image but I do't know how can I take 8x8 blocks from whole image and how I safe it. I use following logic to take 8x8 blocks from image but the prob is it overwrite the previous block value and in last i got only last 8x8 block

%Selecting 8x8 block of the image

x=1;
y=1;
z=1;

for j=1:18
for k=1:22
blck=gf(z:z+7, y:y+7);
y=y+8;
x=x+1;
end
z=z+8;
y=1;
end

can any one help me, how i got 8x8 blocks form image so that after getting them i can process it
Thanks in Advance for Helping me