forked from phg1024/FaceShapeFromShading-MATLAB
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplot_depth.m
42 lines (34 loc) · 813 Bytes
/
plot_depth.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
function plot_depth(depth, new_figure, surface, saveit, filename)
x = depth(:,:,1);
y = depth(:,:,2);
z = depth(:,:,3);
invalid_points = z<-1e1;
x(invalid_points) = [];
y(invalid_points) = [];
z(invalid_points) = [];
if nargin < 2
new_figure=false;
end
if nargin < 3
surface = true;
end
if nargin < 4
saveit = false;
end
if new_figure || saveit
fig = figure;
end
if surface
trisurf(delaunay(x, y), x, y, z, 'edgecolor', 'none', 'facecolor', [0.5, 0.5, 0.5]); material dull;
light('Position',[-2 3 5],'Style','local', 'Color', [0.75, 0.75, 0.75])
light('Position',[2 3 5],'Style','local', 'Color', [0.75, 0.75, 0.75])
else
plot3(x, y, z, 'b.');
end
xlabel('x'); ylabel('y'); zlabel('z');
axis equal; view([0 90]);
if saveit
saveas(fig, filename);
close(fig);
end
end