106 Image and Video Compression
while p< = q
c(:,:,p) = A(j1:j2,k1:k2);
p = p+1;
k1 = k1+4;
k2 = k2+4;
end
q = q+64;
j1 = j1+4;
j2 = j2+4;
k1 = 1;k2 = 4;
r1 = r1+1;
end
for i = 1:4096 % total 4096 blocks
a(:,:,i) = double(c(:,:,i));
end
for i = 1:4:4096 % Select one vector after every 4 vectors,
total 1024 are taken for
%%%%%%%training
net = newsom([0 255 0 255 0255 0255;0 255 0 255 0255 0255; 0
255 0 255 0255 0255; 0 255 0 255 0255 0255],[4]); %% Formation
of SOFM neural network, 0 255 is range of the%%% input pixel
values for 4 rows
net.trainParam.epochs = 100;
net = train(net, a(:,:,i)); %% Start training
CB(:,:,in) = net.iw{1,1}; %% Weights acts as
codevectors, transfer into codebook
sprintf(‘block =%d’, i) %%% Display Block number
end
Once the codebook ...