-
Notifications
You must be signed in to change notification settings - Fork 1
/
example.m
39 lines (30 loc) · 1.32 KB
/
example.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
36
37
38
39
% 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: [email protected]
clear all
clc
close all
% You can customize and fix initial directory paths
TrainDatabasePath = ('C:\Users\Pratyush\Downloads\Image Processing IITB\Eigen faces_04092012\PCA_based Face Recognition System\TrainDatabase');
TestDatabasePath = ('C:\Users\Pratyush\Downloads\Image Processing IITB\Eigen faces_04092012\PCA_based Face Recognition System\TestDatabase');
prompt = {'Enter test image name (a number between 1 to 10):'};
dlg_title = 'Input of PCA-Based Face Recognition System';
num_lines= 1;
def = {'1'};
TestImage = inputdlg(prompt,dlg_title,num_lines,def);
TestImage = strcat(TestDatabasePath,'\',char(TestImage),'.jpg');
im = imread(TestImage);
T = CreateDatabase(TrainDatabasePath);
[m, A, Eigenfaces] = EigenfaceCore(T);
OutputName = Recognition(TestImage, m, A, Eigenfaces);
SelectedImage = strcat(TrainDatabasePath,'\',OutputName);
SelectedImage = imread(SelectedImage);
imshow(im)
title('Test Image');
figure,imshow(SelectedImage);
title('Equivalent Image');
str = strcat('Matched image is : ',OutputName);
disp(str)