source: proiecte/pmake3d/make3d_original/Make3dSingleImageStanford_version0.1/third_party/torr/torr_display_structure.m @ 37

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

Added original make3d

File size: 1.3 KB
Line 
1%       By Philip Torr 2002
2%       copyright Microsoft Corp.
3function f1 = torr_display_structure(X, P1, P2,display_numbers,f1)
4
5
6if nargin < 4
7    display_numbers = 0;
8end
9
10if nargin < 5
11    f1 = figure
12else
13    figure(f1)
14end
15
16
17[M,N] = size(X);
18
19if M==4 %then normalize if homogeneous...
20    X(1,:) = X(1,:) ./  X(4,:);
21    X(2,:) = X(2,:) ./  X(4,:);
22    X(3,:) = X(3,:) ./  X(4,:);
23    X(4,:) = X(4,:) ./  X(4,:);
24end
25   
26%next we want (for display) to remove points at infinity as they will be difficult to display
27%this is done by calculating the centroid of the points and removing ones that are too far away
28%relative to the camera baseline
29baseline = norm([P2(1,4) P2(2,4) P2(3,4)]);
30nearby_index = find(X(3,:) < 40 *  baseline);
31
32plot3(X(1,nearby_index),X(2,nearby_index),X(3,nearby_index),'rs');
33
34% if display_numbers
35%     mat_index1 = 1:N;
36%     mat_index1 = mat_index1';
37%     mat_index = num2str(mat_index1);
38%     text(X(1,:),X(2,:),X(3,:),mat_index)
39% end
40%
41if display_numbers
42    mat_index1 = nearby_index;
43    mat_index1 = mat_index1';
44    mat_index = num2str(mat_index1);
45    text(X(1,nearby_index),X(2,nearby_index),X(3,nearby_index),mat_index)
46end
47
48
49hold on
50plot3(0,0,0,'gs');
51plot3(P2(1,4),P2(2,4),P2(3,4),'gs');
52hold off
53
Note: See TracBrowser for help on using the repository browser.