faceRecog

Face recognition via eigenfaces or fisherfaces

Contents

Syntax

Description

index=faceRecog(testImage, faceData) returns the index of the closest image from the faceData, given the test image.

index=faceRecog(testImage, faceData, frOpt) specifies the options for face recognition via frOpt.

Example

imageDir=[mltRoot, '/dataSet/att_faces(partial)'];
opt=fileList('defaultOpt'); opt.extName='pgm'; opt.mode='recursive';
faceData=fileList(imageDir, opt);
fprintf('Reading %d face images from %s...', length(faceData), imageDir);
tic
for i=1:length(faceData)
%	fprintf('%d/%d: file=%s\n', i, length(faceData), faceData(i).path);
	faceData(i).image=imread(faceData(i).path);
end
fprintf(' ===> %.2f sec\n', toc);
testImage=faceData(1).image;		% Use the first face as the test image
faceData(1)=[];				% Remove the test image from faceData
index=faceRecog(testImage, faceData);	% Perform face recognition using default option
subplot(1,2,1); imagesc(testImage); colormap gray; axis image
title('Query image');
subplot(1,2,2); imagesc(faceData(index).image); colormap gray; axis image
title('Retrieved image');
Reading 100 face images from D:\users\jang\matlab\toolbox\machineLearning/dataSet/att_faces(partial)... ===> 0.12 sec

Top page   Next: faceData2ds.m   Prev:faceRecogDemo.m