error is image recognised with different person

1 view (last 30 days)
i am using Amir Hossein Omidvarnia code of image processing
clc
clear all
close all
vid = videoinput('winvideo',1,'YUY2_320x240');
while(1==1)
choice=menu('Face Recognition',...
'Start Cam',...
'Capture The Image',...
'Recognize The Image',...
'Exit');
if (choice ==1)
start(vid);
preview(vid);
end
if (choice ==2)
set(vid, 'ReturnedColorSpace', 'RGB');
data = getsnapshot(vid);
%diff_im = imsubtract(data(:,:,1), rgb2gray(data));
%diff_im = medfilt2(diff_im, [3 3]);
%diff_im = imadjust(diff_im);
%level = graythresh(diff_im);
%bw = rgb2gray(data);
%c= adapthisteq(bw)
%BW5 = imfill(bw,'holes');
imshow(data)
imwrite(data, 'C:\Users\SUJEET GAURAV\Desktop\attachments_2\TestDatabase\tinku.jpg');
%saveas(diff_im,'testdatabase','jpg')
stop(vid)
closepreview
end
if (choice==3)
TrainDatabasePath = uigetdir( 'C:\Users\SUJEET GAURAV\Desktop\attachments_2', 'Select training database path' );
TestDatabasePath = uigetdir( 'C:\Users\SUJEET GAURAV\Desktop\attachments_2', 'Select test database path');
prompt = {'Enter test image name :'};
dlg_title = 'Input of PCA-Based Face Recognition System';
num_lines= 1;
def = {'tinku'};
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)
end
if (choice==4)
clear choice
return;
end
end
output is not matched with input image why

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!