source: proiecte/pmake3d/make3d_original/Make3dSingleImageStanford_version0.1/third_party/torr/torr_compF_sc.m @ 86

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

Added original make3d

File size: 4.2 KB
Line 
1%       By Philip Torr 2002
2%       copyright Microsoft Corp.
3%main()
4
5%this script compares two methods for estimating F
6%select the two methods and place their ID's in the array methods_used
7%
8
9%methods_used = [4,3]
10
11%comparing non-linear method with Sampson
12%methods_used = [4,2]
13
14%compare sampson and Hegel
15methods_used = [4,7];
16
17%compare bundle and Hegel
18methods_used = [6,7];
19
20%comparing linear and Hegel
21methods_used = [2,7];
22
23
24
25m3 = 256;
26sse2t = 0;
27%
28% randn('state',0)
29% rand('state',0)
30
31no_methods = 7;
32foc = 256;
33best_method_array = zeros(no_methods,1);
34method_sse = zeros(no_methods,1);
35method_n_sse = zeros(no_methods,1);
36epipole_distance = zeros(no_methods,1);
37oo_vicar = 0;
38
39no_matches =100;
40noise_sigma = 1;
41translation_mult = foc * 10;
42translation_adder = 20;
43
44%max number of degrees to rotate
45rotation_multplier = 40;
46min_Z = 1;
47Z_RAN = 10;
48
49
50
51
52no_tests =1;
53
54
55min_noise = 1;
56max_noise = 1;
57percent_gain = zeros(1,max_noise);
58ep_percent_gain = zeros(1,max_noise);
59
60for(noise_sigma = min_noise:max_noise)
61    for(i = 1:no_tests)
62       
63       
64        best_sse = 10000000000;
65        best_method = 5;
66       
67        %generate a load of stuffs
68        %F
69       
70        ave_fa_e  = 0.0;
71        while ave_fa_e < 0.5         
72             [true_F,x1,y1,x2,y2,nx1,ny1,nx2,ny2,true_C,true_R,true_TX, true_E, true_X, true_t]  = ...
73                torr_gen_2view_matches(foc, no_matches, noise_sigma, translation_mult, translation_adder, ...
74                rotation_multplier, min_Z,Z_RAN,m3);
75            [FA, fa] = torr_estfa(x1,y1,x2,y2, no_matches,m3);
76            fa_e = torr_errfa(fa, x1,y1,x2,y2, no_matches, m3);
77           
78            %see what average match looks like
79           
80            ave_fa_e = norm(fa_e,1)/no_matches;
81            if no_tests == 1
82                ave_fa_e;
83            end
84           
85        end
86        %     
87        %     if ssse_fa <6.0
88        %         disp('ooo vicar');
89        %         oo_vicar = oo_vicar + 1;
90        %     end
91        %         %calc true epipole
92        true_epipole = torr_get_right_epipole(true_F,m3);
93       
94        % for method = 2:6
95       
96       
97        for method = methods_used
98           
99            set_rank2 = 1;
100           [nf, f_sq_errors, n_inliers,inlier_index,nF] ...
101               = torr_estimateF( [nx1,ny1,nx2,ny2], m3, [], method,set_rank2);
102           
103            %calc noisy epipole
104            noisy_epipole = torr_get_right_epipole(nF,m3);
105            epipole_distance(method) = epipole_distance(method) + sqrt(norm(true_epipole -noisy_epipole));
106           
107           
108                pe = torr_errf2(nf,x1,y1,x2,y2, no_matches, m3);
109                n_e = torr_errf2(nf,nx1,ny1,nx2,ny2, no_matches, m3);
110 
111                sse_n = norm(pe);
112           
113            if (sse_n < best_sse)
114                best_method = method;
115                best_sse = sse_n;
116            end
117           
118            method_sse(method) =  method_sse(method) + sse_n;
119            method_n_sse(method) =  method_sse(method) + norm(n_e);
120           
121        end %method = 1:4
122        best_method_array(best_method) = best_method_array(best_method)+1;
123    end
124   
125   
126   
127    best_method_array(methods_used)';
128    (method_sse(methods_used)/(no_tests*length(x1)))';
129    (method_n_sse(methods_used)/(no_tests*length(x1)))';
130   
131    percent_gain(noise_sigma) = method_sse(methods_used(1))/method_sse(methods_used(2));
132   
133   
134   
135   
136    %disp('distance to true epipole');
137    (epipole_distance(methods_used)/no_tests)';
138   
139    ep_percent_gain(noise_sigma) = epipole_distance(methods_used(1))/epipole_distance(methods_used(2));
140   
141    %oo_vicar
142    %display_mat(perfect_matches, x1,y1, u1, v1)
143    %
144   
145    %        e = fm_error_hs(F, n1, n2, nowarn);
146   
147   
148    %torr_display_epipoles(nF,nF,perfect_matches, x1,y1, u1, v1)
149end
150
151disp('ratio of first to second method average error on noise free points');
152100 * percent_gain
153
154disp('ratio of first to second method average epipole error');
155100 * ep_percent_gain
156
157disp('number of times gets lowest errors')
158best_method_array
159
160disp('average error for each method')
161method_sse
Note: See TracBrowser for help on using the repository browser.