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

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

Added original make3d

File size: 1.7 KB
Line 
1function [es, as, ss] = impute_compare2(frot,ftrans,sigma,num_frames,n)
2% This will be a comparison with a different occlusion structure, of
3% many points, clustered in groups of three or four, each appearing for very
4% few frames.
5
6if num_frames == -1
7  num_frames = 9;
8end
9ptframes = 5;
10ptcols = 6;
11numpts = ptcols*(1+num_frames-ptframes);
12
13INC = [];
14for i = 1:2:2*(num_frames+1-ptframes)
15  INC = [INC, [zeros(i-1,ptcols); ones(2*ptframes,ptcols); ...
16                zeros(2*num_frames-(i+2*ptframes-1),ptcols)]];
17end
18
19es = [];
20as = [];
21ss = [];
22for i = 1:n
23  [M, pts] = unoccluded_motion(num_frames, numpts, frot, ftrans);
24%      pts = [rand(3,numpts);ones(1,numpts)];
25%      M = rand(2*num_frames,4)*pts;
26  ERR = randn(size(M)).*sigma;
27  Merr = M + ERR;
28  [e,a,s] = rankrsfm_aff_err(M, INC, ERR, pts);
29
30Im = impute(Merr,INC);
31
32  e2 = sum(sum((M.*INC - Im.*INC).^2));
33  a2 = trans_affine_error(Im, pts);
34
35numptsets = 1+num_frames-ptframes;
36% This is the number of different rectangular blocks in INC.
37midframe = 1+floor(numptsets/2);
38% The frame where we start imputing.
39halfrow = 1+2*(midframe-1);
40halfcol = 1+ptcols*(midframe-1);
41[lastrow,lastcol] = size(Merr);
42Imhalf = impute(Merr(halfrow:lastrow, halfcol:lastcol), ...
43                INC(halfrow:lastrow, halfcol:lastcol));
44MerrImhalf = Merr;
45MerrImhalf(halfrow:lastrow, halfcol:lastcol) = Imhalf;
46INCImhalf = INC;
47INCImhalf(halfrow:lastrow, halfcol:lastcol) = ...
48  ones(1+lastrow-halfrow,1+lastcol-halfcol);
49Im2 = impute_up(MerrImhalf,INCImhalf);
50
51  e3 = sum(sum((M.*INC - Im2.*INC).^2));
52  a3 = trans_affine_error(Im2, pts);
53
54  es = [es;[e,e2,e3]];
55  as = [as;[a,a2,a3]];
56  ss = [ss;s];
57
58
59end
60
61global Mexternal INCexternal;
62Mexternal = M;
63INCexternal = INC;
Note: See TracBrowser for help on using the repository browser.