forked from eglxiang/ytf
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_different.m
69 lines (66 loc) · 1.72 KB
/
test_different.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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
%% Testing: whether two sequence represent the same person
% process the first test seq
personname1 = exterior_folders( test_index_set(1)+2 ).name;
video_directory='../feature/';
cd(video_directory);
cd(personname1); % you set personname1
interior_folders=dir;
[num_interior_folders,~]=size(interior_folders);
if num_interior_folders > 2
seqid1 = interior_folders(3).name;
cd(seqid1);
namelist=dir();
[num_files,~]=size(namelist);
if num_files == 11
B1 = [];
for i=3:num_files
inputfilename = namelist(i).name;
fileID = fopen(inputfilename, 'r');
b = fscanf(fileID, '%f');
fclose(fileID);
B1 = [B1; b'];
end
end
B1 = B1*L; %projection
B1 = normr(B1); % normalize rows
end
cd ..
cd ..
personname2 = exterior_folders( test_index_set(2)+2 ).name;
cd(personname2); % you set personname1
interior_folders=dir;
[num_interior_folders,~]=size(interior_folders);
if num_interior_folders > 2
seqid2 = interior_folders(3).name;
cd(seqid2);
namelist=dir();
[num_files,~]=size(namelist);
if num_files == 11
B2 = [];
for i=3:num_files
inputfilename = namelist(i).name;
fileID = fopen(inputfilename, 'r');
b = fscanf(fileID, '%f');
fclose(fileID);
B2 = [B2; b'];
end
end
B2 = B2*L;
B2 = normr(B2);
end
% correlation
corr = B1*B2';
corr_max = max(corr(:))
if corr_max > 0.85
disp('Same person.');
else
disp('Different person.');
end
% [counts, binLocs] = imhist(corr);
% [~,idx] = max(counts);
% corr_majority = binLocs(idx);
% if corr_majority > 0.8
% disp('Same peson.');
% else
% disp('Different person. ');
% end