source: proiecte/pmake3d/make3d_original/Make3dSingleImageStanford_version0.1/third_party/BlueCCal/MultiCamSelfCal/MartinecPajdla/fill_mm/fill_mm_sub.m @ 37

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

Added original make3d

File size: 1.8 KB
Line 
1%fill_mm_sub Proj. reconstruction of a normed sub-scene.
2%
3%   When the central image concept is used, the information which image is
4%   the central image is passed to this function as input.
5%
6%   Parameters:
7%
8%      Mfull .. complete known parts of the problem, used here for the best
9%               estimate of the fundamental matrices
10
11function [P,X, lambda, u1,u2, info] = fill_mm_sub(Mfull, M, central,opt,info)
12
13I = ~isnan(M(1:3:end,:));
14[m n] = size(I);
15if isempty(central), central = 0; end
16
17P=[]; X=[]; lambda=[]; u1=1:m; u2=1:n;
18
19%estimate the fundamental matrices and epipoles with the method of [Har95]
20 [F,ep,rows,nonrows] = M2Fe(Mfull, central);
21
22 if ~isempty(nonrows),
23   disp(sprintf('Used local images:%s.', sprintf(' %d', rows))); end
24 if length(rows) < 2, return; end
25 
26%determine scale faktors lambda_i_p
27 if ~central, rows_central = 0; else rows_central = find(rows == central); end
28 [lambda, Ilamb] = depth_estimation(M(k2i(rows),:),F,ep,rows, ...
29                                    rows_central);
30 
31     % prepare info.show_prmm - for show_prmm function
32     info.show_prmm.I = I;
33     info.show_prmm.Idepths = zeros(m,n); info.show_prmm.Idepths(rows,:)=Ilamb;
34
35%build the rescaled measurement matrix B
36 for i = 1:length(rows), B(k2i(i),:) = M(k2i(i),:).*([1;1;1]*lambda(i,:)); end
37
38%balance W by column-wise and "triplet-of-rows"-wise scalar multiplications
39 B = balance_triplets(B, opt);
40 
41%fit holes in JIM by Jacobs' algorithm
42 [P,X, u1,u2, lambda1, info] = fill_prmm(B, Ilamb, central,opt,info);
43 
44r1 = setdiff(1:length(rows),u1); r2 = setdiff(1:n,u2);
45 
46lambda = lambda(r1,r2);  % to fit P*X
47if ~isempty(lambda1),
48  new = find(~Ilamb(r1,r2) & I(r1,r2)); lambda(new) = lambda1(new); end
49
50error = eucl_dist_only(B(k2i(r1), r2), P*X, ~isnan(B(3*r1,r2)), 3);
51if opt.verbose, disp(sprintf('Error balanced: %f', error)); end
52
53u1 = union(nonrows, rows(u1));
Note: See TracBrowser for help on using the repository browser.