/
plotSupport.m
executable file
·47 lines (42 loc) · 1.12 KB
/
plotSupport.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
function plotSupport(annotation,img,sup)
% Visualize support relations:
Nobjects = length(annotation.object);
parents = find(sup==0);
Nsubplot = length(unique(sup))+2;
Nx = ceil(sqrt(Nsubplot));
Ny = ceil(Nsubplot/Nx);
%% Resize image and annotation for space savings:
[annotation,img] = LMimscale(annotation,img,min(640/size(img,2),1));
for i = 1:Nobjects
[X{i},Y{i}] = getLMpolygon(annotation.object(i).polygon);
end
figure;
subplot(Ny,Nx,1);
LMplot(annotation,img);
legend hide;
k = 2;
i = 1;
while i <= length(parents)
if ismember(parents(i),sup)
subplot(Ny,Nx,k);
imshow(img);
hold on;
Xi = X{parents(i)};
Yi = Y{parents(i)};
plot([Xi; Xi(1)],[Yi; Yi(1)],'r','LineWidth',4);
children = find(sup==parents(i));
for j = 1:length(children)
Xi = X{children(j)};
Yi = Y{children(j)};
plot([Xi; Xi(1)],[Yi; Yi(1)],'b','LineWidth',4);
end
parents = [parents children(~ismember(children,parents))];
title('Support relations');
k = k+1;
end
i = i+1;
end
% $$$ subplot(Ny,Nx,k);
% $$$ showTreeObj(sup,{annotation.object(:).name});
% $$$ axis off;
% $$$ title('Support tree');