-
Notifications
You must be signed in to change notification settings - Fork 44
/
Copy pathemptyinsidepillar.m
81 lines (76 loc) · 2.24 KB
/
emptyinsidepillar.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
70
71
72
73
74
75
76
77
78
79
80
81
function map = emptyinsidepillar(map,objtype)
% Removes the data of floor rate map from the inside of pillars where there should be no data
% at all
% For floors with 40x40 bin only. Other bin sizes will not work since this
% is hardcoded.
% Check if map is linear or grid
if strcmp(objtype,'place')
if any(size(map)==1600)
linear = true;
else
linear = false;
if ~size(map,1)==40
error('grid map is not of expected size');
else
% reshape to linear
map = gridtolinear({map},'place',[40 40]);
end
end
elseif strcmp(objtype,'view')
if any(size(map)==5122)
linear = true;
else
linear = false;
if ~size(map,1)==9
error('grid map is not of expected size');
else
% reshape to linear
map = gridtolinear(map,'view',[1 1;1 1;40 40;40 40;8 160;5 32;5 32;5 32;5 32]);
end
end
end
pillarcoords = [331:338,... % Bottom left
371:378,...
411:418,...
451:458,...
491:498,...
531:538,...
571:578,...
611:618,...
347:354,... % Bottom right
387:394,...
427:434,...
467:474,...
507:514,...
547:554,...
587:594,...
627:634,...
971:978,... % Top left
1011:1018,...
1051:1058,...
1091:1098,...
1131:1138,...
1171:1178,...
1211:1218,...
1251:1258,...
987:994,... % Top right
1027:1034,...
1067:1074,...
1107:1114,...
1147:1154,...
1187:1194,...
1227:1234,...
1267:1274
];
if strcmp(objtype,'view')
pillarcoords = pillarcoords+2;
end
map(pillarcoords) = nan;
if ~linear
if strcmp(objtype,'place')
map = lineartogrid(map,'place',[40 40]);
map = map{1};
elseif strcmp(objtype,'view')
map = lineartogrid(reshape(map,5122,1),'view',[1 1;1 1;40 40;40 40;8 160;5 32;5 32;5 32;5 32]);
end
end