-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathvisualize_result.m
42 lines (31 loc) · 1.18 KB
/
visualize_result.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
function [] = visualize_result(exp_dir,reconstr_name, sel_class,ind)
%
% example: visualize_result('./VOC/','Pascal', 9,6)
%
add_all_paths();
load voc_kp_metadata
in_class = [];
base_dir = ['./Results/' reconstr_name '/' metadata.categories{sel_class} '/'];
load([base_dir 'reconstruction_data.mat']);
sb = SegmBrowser(exp_dir, 'ground_truth', imgset_all);
files = dir([base_dir '*.mat']);
files(arrayfun(@(a) strcmp(a.name, 'reconstruction_data.mat'), files)) = [];
if(nargin ~= 4 || isempty(ind))
ind = randperm(length(files),1);
end
for k = ind
disp(k);
% load reconstructed mesh
load([base_dir files(k).name], 'reconstructions');
[a,b] = max([reconstructions.score]);
r = reconstructions(b);
figure;
im = sb.show_wholes(in_class(reconstructions(1).triples(1)));
subplot(1,2,1);
imshow(im{1}); title('Original Image');
subplot(1,2,2);
trisurf(r.faces,r.vertices(1,:),r.vertices(2,:),r.vertices(3,:)); axis equal
title('Carvi result'); view([0 0 1]);set(gca,'YDir','rev')
set(gca,'Zdir','rev');
end
end