doing multiple tests using one run
Show older comments
i am working on a facial recognition system, and i need some help with creating a loop that allows me to do multiple test in one time run, here is the testing part of the code:
prompt = {'Enter test image name:'};
dlg_title = 'Face Recognition System';
num_lines= 1;
def = {'1'};
TestImage = inputdlg(prompt,dlg_title,num_lines,def);
TestImage = strcat(TestDatabasePath,'/',char(TestImage),'.pgm');
im = imread(TestImage);
toc;
recognition_rate=abs(50*(size(N,2)-wrong)/size(N,2))
T = CreateDatabase(TrainDatabasePath);
[m, A, Eigenfaces] = face(T);
OutputName = recog(TestImage, m, A, Eigenfaces);
SelectedImage = strcat(TrainDatabasePath,'/',OutputName);
SelectedImage = imread(SelectedImage);
imshow(im)
title('Image to be tested');
figure,imshow(SelectedImage);
title('Equivalent Image');
any help?
2 Comments
Walter Roberson
on 10 May 2020
Multiple tests? How? Something along the lines of using uigetfile() with 'MultiSelect', 'on', and processing all of the files the user chooses?
zeina abdelaziz
on 10 May 2020
Answers (1)
Walter Roberson
on 10 May 2020
uigetfile() with 'MultiSelect', 'on' in order to get the list of file names.
Note that there is a trick to uigetfile with multiselect on: if the user selects more than one file then the file names are returned as a cell array of character vectors, but if the user selects only one file than the file name is returned as a character vector that is not in a cell array. The way to deal with that is
[filenames, pathname] = uigetfile('*.png', 'Pick some files', 'multiselect', 'on');
if isnumeric(filenames)
return; %user cancel
end
filenames = cellstr(filenames); %character vector will become cell array of character vector
filenames = fullfile(pathname, filenames); %attach the directory
numfiles = length(filenames);
for K = 1 : numfiles
TestImage = filenames{K};
im = imread(TestImage);
and so on
end
1 Comment
zeina abdelaziz
on 10 May 2020
Categories
Find more on Semantic Segmentation in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!