-
Notifications
You must be signed in to change notification settings - Fork 26
/
Copy pathfilter_bad_camera.m
51 lines (39 loc) · 1.31 KB
/
filter_bad_camera.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
function filter_bad_camera( id )
config;
camera_path = [output_path 'projects_camera/'];
overwrite = false;
fp = fopen(badroom_file);
M = textscan(fp, '%s');
fclose(fp);
bad_room = M{1}(2:end);
for a = 1:length(projects_list)
if rem(a,100)+1 == id
fprintf('%d: %s\n', a, projects_list{a});
camera_name_file = [camera_path projects_list{a} '/room_camera_name.txt'];
camera_good_file = [camera_path projects_list{a} '/room_camera_good.txt'];
if ~overwrite
if exist(camera_good_file, 'file')
fprintf('Exist.\n');
continue;
end
end
if ~exist(camera_name_file, 'file')
fprintf('No camera file.\n');
continue;
end
fp = fopen(camera_name_file);
M = textscan(fp, '%s');
fclose(fp);
camera_name = M{1};
for b = 1:length(camera_name)
p = strfind(camera_name{b}, '_');
camera_name{b} = strrep(camera_name{b}(1:p(end)-1), 'Room#', [projects_list{a} '_']);
end
is_loc_bad_room = ismember(camera_name, bad_room);
fp = fopen(camera_good_file, 'w');
fprintf(fp, '%d\n', ~is_loc_bad_room);
fclose(fp);
fprintf('Done.\n');
end
end
end