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

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

Added original make3d

File size: 2.1 KB
Line 
1function [err, aff_err, stable] = compare_affine(M,INC,r,ERR,pts,n,starts, iter)
2% run shum's method, and mine on the same matrix, and compare with ground truth.
3% Gaussian error is added to the matrix, with sigma as given.
4global Mexternal INCexternal
5
6num_random_starts = starts;
7num_data = num_random_starts+2+2;
8% Each column of the results shows a different method; although the first
9%   num_random_starts columns are all the same iterative method with different
10%   random starting points.  Overall, they're organized as:
11% random starts + my method + my method & iterative, + ground truth + g.t. & it.
12
13[M, INC, ERR, pts] = rem_inc_els_pts(M, INC, ERR, pts, r);
14
15occpercent = 1 - sum(sum(INC))/size(M,1)/size(M,2);
16
17Merr = M + ERR;
18Mexternal = Merr;
19INCexternal = INC;
20INCsize = min(size(INC));
21if INCsize < r
22  err = repeat(-2,num_data);
23  aff_err = repeat(-2,num_data);
24else
25  shum_err = [];
26  shum_aff_err = [];
27  for i=1:num_random_starts
28    [s_err, s_mat] = shum(Merr,INC,r,0,100);
29    if s_err ~= -2
30      s_aff_err = affine_error(s_mat, pts, r);
31    else
32      s_aff_err = -2;
33    end
34    shum_aff_err = [shum_aff_err,s_aff_err];
35    shum_err = [shum_err, s_err];
36  end
37  [rankr_err, rankr_res, stable] = rankr(Merr,INC,r,n, iter);
38  if rankr_err ~= -2
39    rankr_aff_err = affine_error(rankr_res, pts, r);
40  else
41    rankr_aff_err = -2;
42  end
43
44  if rankr_err == -2
45    rankr_shum_err = -2;
46    rankr_shum_aff_err = -2;
47  else
48    [rankr_shum_err, rankr_shum_res] = shum(Merr,INC,r,rankr_res,100);
49    if rankr_shum_err ~= -2
50      rankr_shum_aff_err = affine_error(rankr_shum_res, pts, r);
51    else
52      rankr_shum_aff_err = -2;
53    end
54  end
55
56  ground_truth_aff_err = affine_error(M,pts,r);
57  ground_truth_err = sum(sum((M.*INC - Merr.*INC).^2));
58  [gt_shum_err, gt_shum_res] = shum(Merr,INC,r,M,100);
59
60  if gt_shum_err ~= -2
61    gt_shum_aff_err = affine_error(gt_shum_res, pts, r);
62  else
63    gt_shum_aff_err = -2;
64  end
65  err=[shum_err,rankr_err,rankr_shum_err,ground_truth_err,gt_shum_err];
66  aff_err=[shum_aff_err,rankr_aff_err,rankr_shum_aff_err,ground_truth_aff_err,gt_shum_aff_err];
67end
Note: See TracBrowser for help on using the repository browser.