Matlab
Matlab
4.1 Introduction:
In previous chapters (chapter 2 and chapter 3), we get the theoretical knowledge about the Principal
Component Analysis and Discrete Cosine Transform. In our thesis work we have seen the analysis of
both transform. To execute these tasks we chosen a platform called MATLAB, stands for matrix
laboratory. It is an efficient language for Digital image processing. The image processing toolbox in
MATLAB is a collection of different MATAB functions that extend the capability of the MATLAB
environment for the solution of digital image processing problems. [13]
The PCA is performed based on the calculation given accordingly in chapter 2, based on the
convolution method. So there are a sequence of instructions to be followed in order to perform the PCA
transform.
In the reconstruction we take the transformed image and try to get back the image based on training set.
img=img';
figure(3);
imshow(img);
title('Mean Image','fontsize',18)
% Change image for manipulation
dbx=[]; % A matrix
for i=1:M
temp=double(S(:,i));
dbx=[dbx temp];
end
%Covariance matrix C=A'A, L=AA'
A=dbx';
L=A*A';
% vv are the eigenvector for L
% dd are the eigenvalue for both L=dbx'*dbx and C=dbx*dbx';
[vv dd]=eig(L);
% Sort and eliminate those whose eigenvalue is zero
v=[];
d=[];
for i=1:size(vv,2)
if(dd(i,i)>1e-4)
v=[v vv(:,i)];
d=[d dd(i,i)];
end
end
%sort, will return an ascending sequence
[B index]=sort(d);
ind=zeros(size(index));
dtemp=zeros(size(index));
vtemp=zeros(size(v));
len=length(index);
for i=1:len
dtemp(i)=B(len+1-i);
ind(i)=len+1-index(i);
vtemp(:,ind(i))=v(:,i);
end
d=dtemp;
v=vtemp;
%Normalization of eigenvectors
for i=1:size(v,2) %access each column
kk=v(:,i);
temp=sqrt(sum(kk.^2));
v(:,i)=v(:,i)./temp;
end
%Eigenvectors of C matrix
u=[];
for i=1:size(v,2)
temp=sqrt(d(i));
u=[u (dbx*v(:,i))./temp];
end
%Normalization of eigenvectors
for i=1:size(u,2)
kk=u(:,i);
temp=sqrt(sum(kk.^2));
u(:,i)=u(:,i)./temp;
end
% show eigenfaces
figure(4);
for i=1:size(u,2)
img=reshape(u(:,i),icol,irow);
img=img';
img=histeq(img,255);
subplot(ceil(sqrt(M)),ceil(sqrt(M)),i)
imshow(img)
drawnow;
if i==3
title('Eigenfaces','fontsize',18)
end
end
% Find the weight of each face in the training set
end
omega = [omega WW];
end
% Acquire new image
% Note: the input image must have a bmp or jpg extension.
% It should have the same size as the ones in your training set.
% It should be placed on your desktop
InputImage = input('Please enter the name of the image and its extension \n','s');
InputImage = imread(strcat('C:\Documents and Settings\DERRON\Desktop\pavan\',InputImage));
figure(5)
subplot(1,2,1)
imshow(InputImage); colormap('gray');title('Input image','fontsize',18)
I=InputImage;
InImage=reshape(double(InputImage),irow*icol,1);
temp=InImage;
me=mean(temp);
st=std(temp);
temp=(temp-me)*ustd/st+um;
NormImage = temp;
Difference = temp-m;
p = [];
aa=size(u,2);
for i = 1:aa
pare = dot(NormImage,u(:,i));
p = [p; pare];
end
ReshapedImage = m + u(:,1:aa)*p; %m is the mean image, u is the eigenvector
ReshapedImage = reshape(ReshapedImage,icol,irow);
ReshapedImage = ReshapedImage';
for i=1:size(omega,2)
q = omega(:,i);
DiffWeight = InImWeight-q;
mag = norm(DiffWeight);
e = [e mag];
end
kk = 1:size(e,2);
subplot(1,2,2)
stem(kk,e)
title('Eucledian distance of input image','fontsize',14)
MaximumValue=max(e); % maximum eucledian distance
MinimumValue=min(e) % minimum eucledian distance
CHAPTER 5
CONCLUSIONS AND FUTURE WORK
5.1 Conclusions:
Using the original FERET testing protocol, a standard PCA classifier did better when using
Mahalanobis distance rather than L1, L2 or Angle. In a new set of experiments where the the training
(gallery) and testing (probe) images were selected at random over 10 trials, Mahalanobis was again
superior when 60% of the Eigenvectors were used. However, when only the first 20 Eigenvectors were
used, L2, Angle and Mahalanobis were equivalent. L1 did slightly worse.
Our efforts to combine distance measures did not result in significant performance improvement.
Moreover, the correlation among the L1, L2, Angle and Mahalanobis distance measures, and their
shared bias, suggests that although improvements may be possible by combining the L1 measure with
other measures, such improvements are likely to be small. We also compared the standard method for
selecting a subset of Eigenvectors to one based on like-image similarity. While the like-image method
seems like a good idea, it does not perform better in our experiments. More recent 10 Table 5: Number
of correctly classified images, out of 140, for different algorithm variations. Each row gives results for
a different random selection of training and test data. a) Discard last 40% of the Eigenvectors, b) Keep
only the first 20 Eigenvectors.
Standard Order Sig. Diff. Order
T L2 L1 A M L2 L1 A M
1 59 69 67 89 63 68 65 85
2 61 70 62 82 60 68 62 83
3 54 76 71 89 59 76 70 86
4 53 73 67 83 61 71 66 84
5 62 71 58 83 54 70 59 84
1 46 46 52 55 47 45 53 56
2 50 46 50 56 47 44 49 53
3 54 47 58 48 49 43 56 53
4 46 46 46 52 55 47 45 42
5 42 42 51 50 44 44 52 50
6 49 41 55 48 41 42 56 45
7 53 46 44 49 49 46 44 45
8 45 45 50 45 50 44 48 47
9 55 41 49 51 45 41 49 45
10 43 48 48 52 53 49 46 47
48.3 44.8 50.3 50.6 48.0 44.5 49.8 48.3
(b)
work suggests this technique works better than the standard when used in conjunction with Fischer
Discriminant analysis, but these results are still preliminary. The work presented here was done
primarily by Wendy Yambor as part of her Masters work [17]. At Colorado State, we are continuing to
study the relative performance of alternative face recognition algorithms. We have two goals. The first
being to better understand commonly used algorithms. The second, larger goal, is to develop a more
mature statistical methodology for the study of these algorithms and others like them. This more recent
work is being supported by the DARPA Human Identification at a Distance Program. As part of this
project, we are developing a web site intended to serve as a general resource for researchers wishing to
compare new algorithms to standard algorithms previously published in the literature. This web site
may be found at:
http://www.cs.colostate.edu/evalfacerec/.
Print Email Download Reference This Send to Kindle Reddit This
0 comments
Sign in or Post as Guest
1 person listening
Request Removal
If you are the original writer of this essay and no longer wish to have the essay published on the UK
Essays website then please click on the link below to request removal:
Request the removal of this essay.
Contact Us
Order Now
Instant Price
Search UK Essays