-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathmain_buildhierarchies.m
53 lines (46 loc) · 1.38 KB
/
main_buildhierarchies.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
clear;clc;
util;
addpath(genpath('..\vistools'));
% param setting
load(data_filename); % load the rooms with the relation graphs
load(labelsetname);
wallid_labelset = strmatch('wall',labelset,'exact');
% generate the hierarchies
ndataset = {};
%fdataset = {};
for i = 1:length(dataset)
fprintf(['id:',num2str(i),'\n']);
data = dataset{i};
try
% sort the walls based on counter-clockwise order
% walls are supported by the floor
% floor is not supported by any other object
data = sortWalls_v2(data);
% organize the hierarchies
[kids, ntypelist] = roomhierarchy(data,RELATIONS, NODETYPES);
data.kids = kids;
data.ntypelist = ntypelist;
[ data, done ] = postprocessKids( data );
% select the hierarchies which satisfy the conditions
[ remove ] = selectHierarchies( data, NODETYPES );
% each internal node should have more than one child
len = 0;
for j = 1:length(kids)
if(length(kids{j})>0)
len = 1;
end
end
if(len==0)
remove = 1;
end
catch
remove = 1;
fprintf('error in building the hierarchy!\n');
end
if(remove==0)
ndataset{length(ndataset)+1} = data;
end
%fdataset{i} = data;
end
dataset = ndataset;
save(output_filename, 'dataset');