Page 154 - Algorithm Collections for Digital Signal Processing Applications using MATLAB
P. 154
4. Selected Applications 143
2.2 M-program for Ear Image Data Compression
_________________________________________________________
earcompgv.m
m=1;
for i=1:1:4
for j=1:1:3
for k=1:1:20
s=strcat('ear',num2str(i),num2str(j),'.bmp');
temp=imread(s);
temp=rgb2gray(temp);
x=round(rand*((size(temp,1)-8)))+1;
y=round(rand*((size(temp,2)-8)))+1;
t=temp(x:1:(x+7),y:1:(y+7));
final{m}=double(reshape(t,1,64));
m=m+1;
end
end
end
data=cell2mat(final');
c=cov(data);
[E,V]=eig(c);
%Collecting significant Eigen values
E=E(:,45:1:64);
%Transformation matrix
TM=E';
save TMEIG TM
%Image to be compressed
A=imread('ear11.bmp');
B=rgb2gray(A);
C=blkproc(B,[8 8],'compresseig(x)');
D=blkproc(C,[size(E,2), 1],'decompresseig(x)');
figure
subplot(2,1,1)
imshow(B)
title('EAR IMAGE BEFORE COMPRESSION')
subplot(2,1,2)
D=D(1:1:size(B,1),1:1:size(B,2));
imshow(uint8(D))
title('CORRESPONDING EAR IMAGE AFTER COMRESSION USING EIGEN BASIS')
_______________________________________________________