forked from apsdehal/Face-Recognition
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Example2.m
35 lines (28 loc) · 1.02 KB
/
Example2.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
% A sample script, which shows the usage of functions, included in
% PCA-based face recognition system (Eigenface method)
%
% See also: CREATEDATABASE, EIGENFACECORE, RECOGNITION
% Original version by Amir Hossein Omidvarnia, October 2007
% Email: aomidvar@ece.ut.ac.ir
clear all
clc
close all
% You can customize and fix initial directory paths
TrainDatabasePath = uigetdir( pwd, 'Select training database path' );
video = videoinput('winvideo',1);
set( video, 'ReturnedColorspace', 'RGB');
k = getsnapshot(video);
imwrite(k,'TestImage.jpg');
TestImage = strcat(pwd,'\','TestImage.jpg');
T = CreateDatabase(TrainDatabasePath);
[m, A, Eigenfaces] = EigenfaceCore(T);
OutputName = Recognition(TestImage, m, A, Eigenfaces);
SelectedImage = strcat(TrainDatabasePath,'\',OutputName);
SelectedImage = imread(SelectedImage);
imshow(TestImage);
title('Picture Clicked');
figure,imshow(SelectedImage);
title('Equivalent Image');
str = strcat('Matched image is : ',OutputName);
disp(str)
delete 'TestImage.jpg';