-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_day_night.m
56 lines (41 loc) · 1.57 KB
/
test_day_night.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
% This file is used to compute the matched information for all the data we have
% add vl_feat to path
run('~/lib/vlfeat-0.9.20/toolbox/vl_setup');
% add the folder containing the images
folder_path = '../Data/Selected_Images_DayNight/';
folder_list = dir(folder_path);
num_folders = length(folder_list);
name = 'result.txt';
total_num = 0;
total_num_all = 0;
for i = 1 : num_folders
folder_name = strcat(folder_path, folder_list(i).name);
if strcmp(folder_name(end), '.') || strcmp(folder_name(end-1:end), '..')
continue;
end
% load testing pair images
pair_name = load_day_night(folder_name);
save_name = fullfile(folder_name, name);
outID = fopen(save_name, 'w');
num_pairs = size(pair_name, 1);
for j = 1 : num_pairs
name_1 = fullfile(folder_name, pair_name{j,1});
name_2 = fullfile(folder_name, pair_name{j,2});
I1 = imread(name_1);
I2 = imread(name_2);
gI1 = single(rgb2gray(I1));
gI2 = single(rgb2gray(I2));
[total_matched, correct_1, correct_2, sift_matched, f1, f2] = sift_match_fix_orientation(gI1, gI2);
fprintf(outID, '%s %s ', pair_name{j,1}, pair_name{j,2});
fprintf(outID, '%4d %4d %.2f %4d %4d ', size(total_matched,2), size(correct_1,2), size(correct_1,2)/size(total_matched,2), size(correct_2, 2), size(sift_matched, 2));
if size(correct_1, 2)/size(total_matched, 2) < 0.25
fprintf(outID, '1\n');
total_num = total_num + size(total_matched, 2);
else
fprintf(outID, '0\n');
end
total_num_all = total_num_all + size(total_matched, 2);
end
fclose(outID);
ccc = 0;
end