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

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

Added original make3d

File size: 2.2 KB
Line 
1function [es, as, shum_err] = impute_compare(frot,sigma,n)
2% This will be a simple comparison between an imputation method of
3% Tomasi and Kanade, and my method. 
4
5% matrix will have form:
6% x x x
7% x x x
8% .
9% .
10% .
11% x x x
12% x x x x x x
13% x x x x x x
14% x x x x x x
15% x x x x x x
16%       x x x
17%       x x x
18%         .
19%         .
20%         .
21%       x x x
22
23
24left_start_rows = 1;
25left_end_rows = 18;
26full_start_rows = left_end_rows + 1;
27full_end_rows = full_start_rows + 3;
28right_start_rows = full_end_rows + 1;
29right_end_rows = full_end_rows + left_end_rows;
30
31left_start_col = 1;
32left_end_col = 4;
33right_start_col = left_end_col + 1;
34right_end_col = left_end_col + left_end_col;
35
36es = [];
37as = [];
38shum_err = [];
39
40for i=1:n
41[M, pts] = unoccluded_motion(right_end_rows/2, right_end_col, frot, 0);
42INC = [[ones(left_end_rows, left_end_col), ...
43        zeros(left_end_rows, right_end_col - left_end_col)]; ...
44       ones(full_end_rows - left_end_rows, right_end_col); ...
45       [zeros(right_end_rows - full_end_rows, left_end_col), ...
46        ones(right_end_rows - full_end_rows, right_end_col - left_end_col)]];
47
48ERR = randn(size(M)).*sigma;
49Merr = M + ERR;
50[e1, Mapprox1, s1] = rankr(Merr, INC, 3, 1000, 0);
51a1 = affine_error(Mapprox1, pts, 3);
52
53M_left_top = Merr(left_start_rows:left_end_rows, left_start_col:left_end_col);
54M_right_top = Merr(left_start_rows:left_end_rows, right_start_col:right_end_col);
55M_left_full = Merr(full_start_rows:full_end_rows, left_start_col:left_end_col);
56M_right_full = Merr(full_start_rows:full_end_rows, right_start_col:right_end_col);
57M_left_bottom = Merr(right_start_rows:right_end_rows, left_start_col:left_end_col);
58M_right_bottom = Merr(right_start_rows:right_end_rows, right_start_col:right_end_col);
59
60IM_right_top = M_left_top*(M_left_full\M_right_full);
61IM_left_bottom = M_right_bottom*(M_right_full\M_left_full);
62
63IM = [[M_left_top, IM_right_top];[M_left_full, M_right_full];...
64        [IM_left_bottom, M_right_bottom]];
65Mapprox2 = approx_full_matrix(IM,3);
66e2 = sum(sum((M.*INC - Mapprox2.*INC).^2));
67a2 = affine_error(Mapprox2, pts, 3);
68
69[shum_err1, shum_res1] = shum(Merr,INC,3,Mapprox1,100);
70[shum_err2, shum_res2] = shum(Merr,INC,3,Mapprox2,100);
71
72es = [es; [e1,e2]];
73as = [as; [a1,a2]];
74shum_err = [shum_err; [shum_err1,shum_err2]];
75end
Note: See TracBrowser for help on using the repository browser.