source: proiecte/pmake3d/make3d_original/Make3dSingleImageStanford_version0.1/third_party/torr/torr_compare_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.9 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_compare_epipoles(Fmat1,Fmat2,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%for(i = 1:length(x1))   
31plot (matches(:,1), matches(:,2),'r+')
32plot (matches(:,3), matches(:,4),'r+')
33%end
34
35quiver(x1, y1, u1, v1, 0)   
36
37hold off
38
39f2 = figure
40m1 = max(max(matches));
41m2 = min(min(matches));
42m2 = -m2;
43g = max(m1,m2);
44
45axis([-g g -g g])       
46hold on
47
48%for(i = 1:length(x1))   
49plot (matches(:,1), matches(:,2),'r+')
50plot (matches(:,3), matches(:,4),'r+')
51%end
52
53quiver(x1, y1, u1, v1, 0)   
54
55hold off
56
57button = 1;
58while ~isempty(button)
59   
60    %this takes one image and draws the corresponding epipolar line.
61    %     Fmat = [[f(1) f(2) f(3)]; [f(4) f(5) f(6)];[f(7) f(8) f(9)]]
62    %     
63   
64   
65    figure(f1);
66    %     
67    %     [U,S,V] = svd(Fmat);
68    %     S(3,3) = 0;
69    %     F2 = U*S*V';
70   
71    %     [v,d] = eig(Fmat1);
72    %     epipole = v(:,3);
73    %     epipole = epipole * (m3/epipole(3);
74    %     %Fmat * ee
75    %     
76   
77   
78    hold on
79    [Xcur,Ycur,button] = GINPUT(1);
80    plot(Xcur,Ycur, 'g+');
81   
82    xxx1 = [Xcur,Ycur, 256.0];
83   
84    % (x2 y2 m3) F (x1 y1 m3)'
85    %  (image 2) F ( image 1)'
86   
87    el2 = Fmat1 * xxx1';
88   
89   
90    figure(f2)
91   
92    %define two points x1 = 0, x2 =
93    % note x 1 + y 2 + m3 3 = 0
94    % y = (-m3 3 - x 1 ) / 2
95   
96    nr = 512;
97    nc = 512;
98   
99    x1 = -400000;
100    %    y1 = - el2(3) * 256/el2(2);
101    y1 =( -x1 * el2(1) - el2(3) * 256)/el2(2);
102   
103    x2 = nr;
104    y2 = (- el2(3) * 256 - x2 * el2(1))/el2(2);
105   
106   
107   
108    hold on
109    a = [x1,x2];
110    b = [ y1,y2 ];
111    line(a,b,'Color','r');
112   
113   
114   
115    el2 = Fmat2 * xxx1';
116   
117   
118    %define two points x1 = 0, x2 =
119    % note x 1 + y 2 + m3 3 = 0
120    % y = (-m3 3 - x 1 ) / 2
121   
122   
123    x1 = -400;
124    y1 =( -x1 * el2(1) - el2(3) * 256)/el2(2);
125   
126    x2 = nr;
127    y2 = (- el2(3) * 256 - x2 * el2(1))/el2(2);
128   
129   
130   
131    hold on
132    a = [x1,x2];
133    b = [ y1,y2 ];
134   
135    figure(f1);
136    plot(Xcur,Ycur, 'g+');
137    figure(f2);
138    line(a,b,'Color','g');
139   
140end
141
142%
143% function g =  display_mat(matches, x1,y1, u1, v1)
144%   
145%    m1 = max(max(matches));
146%    m2 = min(min(matches));
147%    m2 = -m2;
148%    g = max(m1,m2);
149%   
150%    axis([-g g -g g]) 
151%       hold on
152
153%       for(i = 1:length(x1))   
154%       plot (matches(i,1), matches(i,2),'r+')
155%       plot (matches(i,3), matches(i,4),'r+')
156%    end
157%
158%       quiver(x1, y1, u1, v1, 0)   
159%
160%       hold off
Note: See TracBrowser for help on using the repository browser.