source: proiecte/pmake3d/make3d_original/Make3dSingleImageStanford_version0.1/third_party/missing-data/trans_best.m @ 37

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

Added original make3d

File size: 2.6 KB
Line 
1function [R, means, stds] = trans_best(a, stab, fname)
2% a contains the results of the new experiments, that contain the new algorithm
3% geared for sfm. 
4
5% Each iteration had 12 results.  All but one had no translation in the
6% motion, and did not allow for translation in the algorithm.  There
7% were: five applications of Shum with random starting points, the old
8% method, old + shum, the new method (geared to motion, using all frame
9% pairs, but with no translation allowed), new method + shum, new method
10% allowing for translation, ground truth, ground truth + shum.
11
12% I'm going to ignore the old method here, since it seems clearly worse than the new
13% one, and I won't include it in the paper.
14
15R = [];
16for marg = [2, 1.1, 1.01];
17% We'll look for all results within 10 percent of the best solution.
18
19numrows = size(a,1);
20
21its = abs(a(:,[1:5,9,12]));
22minits = (min(its'))';
23minits_marg = marg*minits;
24itsbest = its < minits_marg*ones(1,7);
25
26ran1 = sum(sum(itsbest(:,1:5)))/(5*numrows);
27ran3 = sum(max((itsbest(:,1:3))'))'/numrows;
28ran5 = sum(max((itsbest(:,1:5))'))'/numrows;
29
30Rt = [ran1,ran3,ran5,sum(itsbest(:,6:7))/numrows];
31R = [R;Rt];
32end
33
34% Here I'm going to process results by producing mean and standard deviation.
35
36shum1 = abs(reshape(a(:,1:5),numrows*5,1));
37m1 = mean(shum1);
38s1 = std(shum1)/sqrt(5*numrows);
39shum3 = (min(abs((a(:,1:3))')))';
40shum5 = (min(abs((a(:,1:5))')))';
41exps = [shum3, shum5, abs(a(:,6:12))];
42
43stabs = [ones(numrows,2), stab(:,6), stab(:,6), stab(:,8), stab(:,8), ...
44              stab(:,10), ones(numrows,2)];
45% My methods, and iterative refinements of them may be unstable.
46stabexps = exps.*stabs
47numstab = sum(stabs)
48means = [m1, sum(stabexps)./numstab];
49stds = [s1, sqrt( sum(stabexps.^2)./numstab - (sum(stabexps)./numstab).^2)./sqrt(numstab)];
50
51%means = [m1,mean(exps)];
52%stds = [s1,std(exps)./sqrt(numrows)];
53
54if fname
55fid = fopen(fname, 'a');
56fprintf(fid, '%% Data written from trans_best.\n\n');
57
58fprintf(fid, 'Mean/(standard deviation) of: 1it, 3it, 5it, old, oldit, new, newit, newtrans, gt, gtit\n\n');
59for i = 1:10
60  m = means(i);
61  s = stds(i);
62  fprintf(fid, '%4.8f/(%4.8f)\n', m, s);
63end
64
65fprintf(fid, '\n\nFraction times each iterative method converged to right answer.');
66fprintf(fid, '\nMethods are 1it, 3it, 5it, newit, gtit');
67fprintf(fid, '\nRows show convergence within 100, 10 and 1 percent of best answer.');
68
69fprintf(fid, '\n\n  %1.4f  %1.4f  %1.4f  %1.4f  %1.4f', R(1,1), R(1,2), R(1,3), R(1,4), R(1,5));
70fprintf(fid, '\n  %1.4f  %1.4f  %1.4f  %1.4f  %1.4f', R(2,1), R(2,2), R(2,3), R(2,4), R(2,5));
71fprintf(fid, '\n  %1.4f  %1.4f  %1.4f  %1.4f  %1.4f', R(3,1), R(3,2), R(3,3), R(3,4), R(3,5));
72
73fclose(fid);
74end
Note: See TracBrowser for help on using the repository browser.