[37] | 1 | function [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 | |
---|
| 6 | if num_frames == -1 |
---|
| 7 | num_frames = 9; |
---|
| 8 | end |
---|
| 9 | ptframes = 5; |
---|
| 10 | ptcols = 6; |
---|
| 11 | numpts = ptcols*(1+num_frames-ptframes); |
---|
| 12 | |
---|
| 13 | INC = []; |
---|
| 14 | for 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)]]; |
---|
| 17 | end |
---|
| 18 | |
---|
| 19 | es = []; |
---|
| 20 | as = []; |
---|
| 21 | ss = []; |
---|
| 22 | for 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 | |
---|
| 30 | Im = impute(Merr,INC); |
---|
| 31 | |
---|
| 32 | e2 = sum(sum((M.*INC - Im.*INC).^2)); |
---|
| 33 | a2 = trans_affine_error(Im, pts); |
---|
| 34 | |
---|
| 35 | numptsets = 1+num_frames-ptframes; |
---|
| 36 | % This is the number of different rectangular blocks in INC. |
---|
| 37 | midframe = 1+floor(numptsets/2); |
---|
| 38 | % The frame where we start imputing. |
---|
| 39 | halfrow = 1+2*(midframe-1); |
---|
| 40 | halfcol = 1+ptcols*(midframe-1); |
---|
| 41 | [lastrow,lastcol] = size(Merr); |
---|
| 42 | Imhalf = impute(Merr(halfrow:lastrow, halfcol:lastcol), ... |
---|
| 43 | INC(halfrow:lastrow, halfcol:lastcol)); |
---|
| 44 | MerrImhalf = Merr; |
---|
| 45 | MerrImhalf(halfrow:lastrow, halfcol:lastcol) = Imhalf; |
---|
| 46 | INCImhalf = INC; |
---|
| 47 | INCImhalf(halfrow:lastrow, halfcol:lastcol) = ... |
---|
| 48 | ones(1+lastrow-halfrow,1+lastcol-halfcol); |
---|
| 49 | Im2 = 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 | |
---|
| 59 | end |
---|
| 60 | |
---|
| 61 | global Mexternal INCexternal; |
---|
| 62 | Mexternal = M; |
---|
| 63 | INCexternal = INC; |
---|