source: proiecte/pmake3d/make3d_original/Make3dSingleImageStanford_version0.1/third_party/3dRecon/utils/getHalfDino.m @ 37

Last change on this file since 37 was 37, checked in by (none), 14 years ago

Added original make3d

File size: 1.9 KB
Line 
1function [v, f] = getHalfDino(CHATTY)
2%% [verts, faces] = getHalfDino(CHATTY)
3%% If CHATTY (default FALSE) then do display
4FALSE = 0==1;
5TRUE = ~FALSE;
6
7if nargin == 0
8  CHATTY = 0;
9end
10
11
12%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
13%%% Read and display Dino data set
14%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
15dinoData;
16
17if CHATTY
18  lines = showWire(verts,faces,1);
19  title('Full Dino Data Set');
20  fprintf(2,'Rotate this figure.\n');
21  fprintf(2,'Press any key to continue...');
22  pause; fprintf(2,'ok\n');
23end
24
25%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
26%%% Extract one side of Dino in principal coordinates
27%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
28%% Find Dino's principal axes
29mn = sum(verts,1)/size(verts,1);
30[U S V] = svd(verts-repmat(mn, size(verts,1), 1), 0); S = diag(S);
31
32%% Expect third axis to be the lateral direction.
33%% Remove vertices with z < 0
34id = U(:,2) < -0.001;
35
36%% Compute vertices in principal axes.
37v = U(~id, :)*diag(S);
38
39%% Relabel the remaining vertices
40relabel = zeros(size(verts,1),1);
41relabel(~id) = 1:sum(~id);
42
43%% Write the faces in terms of the relabelled vertices
44f={}; j=0;
45for k = 1:length(faces)
46  if ~any(id(faces{k}))
47    j = j+1;
48    f{j} = relabel(faces{k})';
49  end
50end
51
52if CHATTY
53  l = showWire(v,f,1);
54  title('One Sided Dino Data Set');
55  fprintf(2,'Rotate this figure.\n');
56  fprintf(2,'Press any key to continue...');
57  pause; fprintf(2,'ok\n');
58
59  %%%%% Show Dino as a surface plot
60  figure(3); clf;
61  for k = 1:length(f)
62    vf = v(f{k},:);
63    patch(vf(:,1), vf(:,2), vf(:,3), vf(:,2));
64  end
65  set(gca,'YDir', 'reverse');
66  axis vis3d; axis square; axis equal;
67  title('One Sided Dino Data Set');
68  fprintf(2,'Rotate this figure.\n');
69  fprintf(2,'Press any key to continue...');
70  pause;
71  fprintf(2,'ok\n');
72
73end
74return;
Note: See TracBrowser for help on using the repository browser.