source: proiecte/pmake3d/make3d_original/Make3dSingleImageStanford_version0.1/third_party/torr/torr_test_calib_sc2.m @ 37

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

Added original make3d

File size: 2.7 KB
Line 
1%this is a script to test the self calibration stuff
2%torr_test_calib_sc.m
3%main()
4%profile on
5clear all;
6m3 = 256;
7method = 'mapsac';
8%method = 'linear';
9
10
11% % do we want the same result each time
12% randn('state',0)
13% rand('state',0)
14no_test = 1;
15for(i = 1:no_test)
16
17%     [true_F,x1,y1,x2,y2,nx1,ny1,nx2,ny2] = ...
18%         torr_gen_2view_matches(foc, no_matches, noise_sigma, translation_mult, translation_adder, ...
19%         rotation_multplier, min_Z,Z_RAN,m3);
20[true_F,x1,y1,x2,y2,nx1,ny1,nx2,ny2,true_C,true_R,true_TX, true_E] = torr_gen_2view_matches;
21
22% m3 = 256
23x_a       = [x1,y1,repmat(m3,length(x1),1)];
24x_a_prime = [x2,y2,repmat(m3,length(x1),1)];
25
26err_calc_a = [];
27for k = 1:length(x1),
28    err_calc_a = [err_calc_a; (x_a_prime(k,:)) * true_F * (x_a(k,:)')];
29end
30
31%total sum of error
32disp('======================================================================');
33disp(sprintf('Sum of squared error for true_F:  x_prime*F*x = %d',sum(err_calc_a.^2)));
34disp('======================================================================');
35
36no_matches = length(nx1);
37
38%if we set this to one then the result should be the same as the groundtruth...
39no_noise = 1;
40if (no_noise)
41    disp('just using noise free points');
42    nx1 = x1;
43    nx2 = x2;
44    ny1 = y1;
45    ny2 = y2;
46end
47
48
49
50matches = [nx1,ny1,nx2,ny2];
51perfect_matches = [x1,y1,x2,y2];
52set_rank2 = 1;
53
54%first estimate F
55%disp('First Match');
56%matches(1,:)
57[f, e1, n_inliers,inlier_index,nF] = torr_estimateF( perfect_matches, m3, [], method, set_rank2);
58
59x_b       = [x1,y1,repmat(m3,length(x1),1)];
60x_b_prime = [x2,y2,repmat(m3,length(x1),1)];
61
62err_calc_b = [];
63for k = 1:length(x1),
64    err_calc_b = [err_calc_b; (x_a_prime(k,:)) * nF * (x_a(k,:)')];
65end
66
67%total sum of error
68disp('======================================================================');
69disp(sprintf('Sum of squared error for mapsac nF: x_prime*nF*x = %d',sum(err_calc_b.^2)));
70disp('======================================================================');
71
72end
73
74
75method = 'linear';
76%first estimate F
77%disp('First Match');
78%matches(1,:)
79[f, e1, n_inliers,inlier_index,nF] = torr_estimateF( perfect_matches, m3, [], method, set_rank2);
80
81x_b       = [x1,y1,repmat(m3,length(x1),1)];
82x_b_prime = [x2,y2,repmat(m3,length(x1),1)];
83
84err_calc_b = [];
85for k = 1:length(x1),
86    err_calc_b = [err_calc_b; (x_a_prime(k,:)) * nF * (x_a(k,:)')];
87end
88
89%total sum of error
90disp('======================================================================');
91disp(sprintf('Sum of squared error for linear nF: x_prime*nF*x = %d',sum(err_calc_b.^2)));
92disp('======================================================================');
Note: See TracBrowser for help on using the repository browser.