-
Notifications
You must be signed in to change notification settings - Fork 0
/
face_recognition.m
29 lines (25 loc) · 1.03 KB
/
face_recognition.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
%%% Face Recognition using PCA %%%
clear all
close all
clc
%%%%%%% provide the data path where the training images are present %%%%%%%
datapath = uigetdir('C:\Users\OneDrive\Documents\Eigen kit','select path of training images');
testpath = uigetdir('C:\Users\OneDrive\Documents\tt','select path of test images');
prompt = {'Enter test image name (a number between 1 to 10):'};
dlg_title = 'Input of PCA-Based Face Recognition System';
num_lines= 1;
def = {' '};
TestImage = inputdlg(prompt,dlg_title,num_lines,def);
TestImage = strcat(testpath,'\',char(TestImage),'.jpg');
%%%%%%%%%%%%% calling the functions %%%%%%%%%%%%%%%%%%%%%%%%
recog_img = facerecog(datapath,TestImage);
selected_img = strcat(datapath,'\',recog_img);
select_img = imread(selected_img);
imshow(select_img);
title('Recognized Image');
test_img = imread(TestImage);
figure,imshow(test_img);
title('Test Image');
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
result = strcat('the recognized image is : ',recog_img);
disp(result);