1 | % By Philip Torr 2002
|
---|
2 | % copyright Microsoft Corp.
|
---|
3 | %main()
|
---|
4 | %profile on
|
---|
5 | m3 = 256;
|
---|
6 | sse2t = 0;
|
---|
7 | %method = 5;
|
---|
8 | %
|
---|
9 |
|
---|
10 |
|
---|
11 | if new_random == 0
|
---|
12 | state_rand = 400;
|
---|
13 | randn('state',state_rand)
|
---|
14 | rand('state',state_rand)
|
---|
15 | end
|
---|
16 |
|
---|
17 | trans = 0;
|
---|
18 | true_epipole = torr_get_right_epipole(true_F,m3);
|
---|
19 |
|
---|
20 |
|
---|
21 | for(i = 1:1)
|
---|
22 |
|
---|
23 | %generate a load of stuffs
|
---|
24 | torr_genf;
|
---|
25 |
|
---|
26 | nX1 = [nx1,ny1, ones(length(x1),1) * m3];
|
---|
27 | nX2 = [nx2,ny2, ones(length(x2),1) * m3];
|
---|
28 |
|
---|
29 | %mine
|
---|
30 | %f_torr = estf(nx1,ny1,nx2,ny2, no_matches,m3);
|
---|
31 |
|
---|
32 | %the F matrix is defined like:
|
---|
33 | % (nx2, ny2, m3) f(1 2 3) nx1
|
---|
34 | % (4 5 6) ny1
|
---|
35 | % (7 8 9) m3
|
---|
36 |
|
---|
37 | %first try linear method
|
---|
38 | method = 3
|
---|
39 |
|
---|
40 | [nF , nf]= fm_linear(nX1, nX2, eye(3), method);
|
---|
41 | %calc noisy epipole
|
---|
42 | noisy_epipole = torr_get_right_epipole(nF,m3)
|
---|
43 | epipole_distance = sqrt(norm(true_epipole -noisy_epipole))
|
---|
44 |
|
---|
45 |
|
---|
46 | ne1 = torr_errf2(nf,x1,y1,x2,y2, no_matches, m3);
|
---|
47 |
|
---|
48 | sne1 = sort(ne1);
|
---|
49 | % sse_n = norm(sne1(20:no_matches-20))
|
---|
50 | sse_n = norm(sne1)
|
---|
51 | % nf'
|
---|
52 |
|
---|
53 | %
|
---|
54 | method = 5
|
---|
55 |
|
---|
56 | [nF2 , nf2]= fm_linear(nX1, nX2, eye(3), method);
|
---|
57 | %calc noisy epipole
|
---|
58 | noisy_epipole2 = torr_get_right_epipole(nF2,m3)
|
---|
59 | epipole_distance2 = sqrt(norm(true_epipole -noisy_epipole2))
|
---|
60 |
|
---|
61 | ne2 = torr_errf2(nf2,x1,y1,x2,y2, no_matches, m3);
|
---|
62 |
|
---|
63 | sne2 = sort(ne2);
|
---|
64 | % sse_n2 = norm(sne2(20:no_matches-20))
|
---|
65 | sse_n2 = norm(sne2)
|
---|
66 | % nRf'
|
---|
67 |
|
---|
68 |
|
---|
69 |
|
---|
70 | end
|
---|
71 |
|
---|
72 |
|
---|
73 | if draw_epipole
|
---|
74 | torr_display_epipoles(nF,nF2,perfect_matches, x1,y1, u1, v1)
|
---|
75 | end
|
---|
76 | %profile off
|
---|
77 | %
|
---|
78 | %
|
---|
79 | % some crap
|
---|
80 | %
|
---|
81 | % >> XX2 = [x2(1), y2(1), m3]
|
---|
82 | %
|
---|
83 | % XX2 =
|
---|
84 | %
|
---|
85 | % 101.4245 -119.2097 256.0000
|
---|
86 | %
|
---|
87 | % >> XX1 = [x1(1), y1(1), m3]
|
---|
88 | %
|
---|
89 | % XX1 =
|
---|
90 | %
|
---|
91 | % 49.3714 -140.5000 256.0000
|
---|
92 | %
|
---|
93 | % >>
|
---|
94 | %
|
---|
95 | %
|
---|
96 | %
|
---|
97 | %
|
---|
98 |
|
---|
99 |
|
---|
100 | % e = fm_error_hs(F, n1, n2, nowarn);
|
---|
101 |
|
---|
102 | if sse_n2 < sse_n
|
---|
103 | disp('Bookstein + Sampson betta')
|
---|
104 | else
|
---|
105 | disp('old betta')
|
---|
106 | end |
---|