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

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

Added original make3d

File size: 2.5 KB
Line 
1%       By Philip Torr 2002
2%       copyright Microsoft Corp.
3% so we display an epipolar line in an image
4
5
6function torr_display_epipoles(Fmat1,matches, m3)
7
8x1 = matches(:,1);
9y1 = matches(:,2);
10u1 = matches(:,3) - x1;
11v1 = matches(:,4) - y1;
12
13
14if nargin < 7
15    m3 = 256
16end
17
18% (x2 y2 m3) F (x1 y1 m3)'
19%  (image 2) F ( image 1)'
20
21f1 = figure
22m1 = max(max(matches));
23m2 = min(min(matches));
24m2 = -m2;
25g = max(m1,m2);
26
27axis([-g g -g g])       
28hold on
29
30    plot (matches(:,1), matches(:,2),'r+')
31    plot (matches(:,3), matches(:,4),'r+')
32
33quiver(x1, y1, u1, v1, 0)   
34
35hold off
36
37f2 = figure
38m1 = max(max(matches));
39m2 = min(min(matches));
40m2 = -m2;
41g = max(m1,m2);
42
43axis([-g g -g g])       
44hold on
45
46    plot (matches(:,1), matches(:,2),'r+')
47    plot (matches(:,3), matches(:,4),'r+')
48
49quiver(x1, y1, u1, v1, 0)   
50
51hold off
52
53button = 1;
54
55while ~isempty(button)
56   
57    %this takes one image and draws the corresponding epipolar line.
58    %     Fmat = [[f(1) f(2) f(3)]; [f(4) f(5) f(6)];[f(7) f(8) f(9)]]
59    %     
60   
61   
62    figure(f1);
63    %     
64    %     [U,S,V] = svd(Fmat);
65    %     S(3,3) = 0;
66    %     F2 = U*S*V';
67   
68    %     [v,d] = eig(Fmat1);
69    %     epipole = v(:,3);
70    %     epipole = epipole * (m3/epipole(3);
71    %     %Fmat * ee
72    %     
73   
74   
75    hold on
76    [Xcur,Ycur,button] = GINPUT(1);
77    plot(Xcur,Ycur, 'g+');
78   
79    xxx1 = [Xcur,Ycur, 256.0];
80   
81    % (x2 y2 m3) F (x1 y1 m3)'
82    %  (image 2) F ( image 1)'
83   
84    el2 = Fmat1 * xxx1';
85   
86   
87    figure(f2)
88   
89    %define two points x1 = 0, x2 =
90    % note x 1 + y 2 + m3 3 = 0
91    % y = (-m3 3 - x 1 ) / 2
92   
93    nr = 512;
94    nc = 512;
95   
96    x1 = -100000;
97    %    y1 = - el2(3) * 256/el2(2);
98    y1 =( -x1 * el2(1) - el2(3) * 256)/el2(2);
99   
100    x2 = nr;
101    y2 = (- el2(3) * 256 - x2 * el2(1))/el2(2);
102   
103   
104   
105    hold on
106    a = [x1,x2];
107       
108    figure(f1);
109    b = [ y1,y2 ];
110%    plot(x1,y1, 'g+');
111    plot(Xcur,Ycur, 'gs');
112       
113    figure(f2);
114    line(a,b,'Color','r');
115   
116 
117   
118end
119
120%
121% function g =  display_mat(matches, x1,y1, u1, v1)
122%   
123%    m1 = max(max(matches));
124%    m2 = min(min(matches));
125%    m2 = -m2;
126%    g = max(m1,m2);
127%   
128%    axis([-g g -g g]) 
129%       hold on
130
131%       for(i = 1:length(x1))   
132%       plot (matches(i,1), matches(i,2),'r+')
133%       plot (matches(i,3), matches(i,4),'r+')
134%    end
135%
136%       quiver(x1, y1, u1, v1, 0)   
137%
138%       hold off
Note: See TracBrowser for help on using the repository browser.