1 | % By Philip Torr 2002
|
---|
2 | % copyright Microsoft Corp.
|
---|
3 | % so we display an epipolar line from image 1 into image 2
|
---|
4 | %%%%%%%
|
---|
5 |
|
---|
6 | %display the epipolar geometetry for all matches
|
---|
7 | function torr_disp_epip_geom(f,matches,ax_handle2,ax_handle3,m3)
|
---|
8 |
|
---|
9 | % (x2 y2 m3) F (x1 y1 m3)'
|
---|
10 | % (image 2) F ( image 1)'
|
---|
11 |
|
---|
12 | %while 1
|
---|
13 |
|
---|
14 | %this takes one image and draws the corresponding epipolar line.
|
---|
15 | Fmat = [[f(1) f(2) f(3)]; [f(4) f(5) f(6)];[f(7) f(8) f(9)]];
|
---|
16 |
|
---|
17 |
|
---|
18 |
|
---|
19 | [U,S,V] = svd(Fmat);
|
---|
20 | S(3,3) = 0;
|
---|
21 | F2 = U*S*V';
|
---|
22 |
|
---|
23 | [v,d] = eig(F2);
|
---|
24 | ee = v(:,1);
|
---|
25 | %Fmat * ee
|
---|
26 |
|
---|
27 |
|
---|
28 |
|
---|
29 | axes(ax_handle2);
|
---|
30 | hold on
|
---|
31 |
|
---|
32 | n_plots = length(matches);
|
---|
33 |
|
---|
34 | % plot(matches(:,1),matches(:,2), 'w+','LineWidth',2);
|
---|
35 | xxx1 = [matches(:,1),matches(:,2), ones(n_plots,1) * m3];
|
---|
36 |
|
---|
37 | % (x2 y2 m3) F (x1 y1 m3)'
|
---|
38 | % (image 2) F ( image 1)'
|
---|
39 |
|
---|
40 | el2 = F2 * xxx1';
|
---|
41 | %is this the wrogn way round>
|
---|
42 | el2 = el2';
|
---|
43 |
|
---|
44 |
|
---|
45 | axes(ax_handle3);
|
---|
46 |
|
---|
47 | %define two points x1 = 0, x2 =
|
---|
48 | % note x 1 + y 2 + m3 3 = 0
|
---|
49 | % y = (-m3 3 - x 1 ) / 2
|
---|
50 |
|
---|
51 |
|
---|
52 | x1 = ones(n_plots,1) * -20000;
|
---|
53 | % y1 = - (el2(:,3) * m3) ./el2(:,2);
|
---|
54 | y1 = (- (el2(:,3) * m3) - (x1(:) .* el2(:,1))) ./el2(:,2);
|
---|
55 |
|
---|
56 | x2 = ones(n_plots,1) * 2000;
|
---|
57 | y2 = (- (el2(:,3) * m3) - (x2(:) .* el2(:,1))) ./el2(:,2);
|
---|
58 |
|
---|
59 |
|
---|
60 |
|
---|
61 | hold on
|
---|
62 | a = [x1,x2]';
|
---|
63 | b = [ y1,y2 ]';
|
---|
64 | % plot(x1,y1, 'g+');
|
---|
65 | % colours = rand(length(x1),3);
|
---|
66 | line(a,b,'Color','r');
|
---|
67 |
|
---|
68 | hold off
|
---|
69 |
|
---|
70 | %end |
---|