source: proiecte/pmake3d/make3d_original/Make3dSingleImageStanford_version0.1/third_party/BlueCCal/MultiCamSelfCal/MartinecPajdla/fill_mm_test/fill_mm_bundle.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 
1%fill_mm_bundle Proj. reconstruction from MM [with bundle adjustment].
2%
3%  Call fill_mm [and bundle adjustment].
4%
5%  [ P,X, u1,u2, info ] = fill_mm_bundle(M [,opt])
6%
7%  Parameters:
8%    M .. measurement matrix (MM) with homogeneous image points with NaNs
9%         standing for the unknown elements in all three coordinates
10%    imsize .. double(2,m), image sizes: imsize(:,i) is size of image i
11%                           m .. No. of cameras
12%    opt .. options with default values in ():
13%           .no_BA(0) .. whether refine using bundle adjustment
14%           .verbose(1) .. whether display info
15%           .verbose_short .. see opt in bundle_PX_proj
16%           ... other options see in fill_mm
17%
18%  Return parameters:
19%    info.R_lin .. linear estimation of filled M
20%    ... other parameters see in fill_mm
21
22function [ P,X, u1,u2, info ] = fill_mm_bundle(M, imsize, opt)
23
24if nargin < 3, opt = []; end
25if ~isfield(opt, 'no_BA')
26  opt.no_BA = 0; end
27if ~isfield(opt, 'verbose'),
28  opt.verbose = 1; end
29 
30[P,X, u1,u2, info] = fill_mm(M, opt);
31
32info.R_lin = P*X;
33
34if ~opt.no_BA & length(u1) < size(M,1)/3 & length(u2) < size(M,2)
35  if opt.verbose, fprintf(1, 'Bundle adjustment...\n'); tic; end
36 
37  [m,n] = size(M); m = m/3; r1 = setdiff(1:m,u1); r2 = setdiff(1:n,u2);
38  [P,X] = bundle_PX_proj(P,X, normalize_cut(M(k2i(r1),r2)), imsize, opt);
39  % old bundler:
40  %[P,X] = qPXbundle_cmp(P,X, normalize_cut(M(k2i(r1),r2)));
41 
42  if opt.verbose, disp(['(' num2str(toc) ' sec)']); end
43  info.err.BA = dist(M(k2i(r1),r2), P*X, info.opt.metric);
44  if opt.verbose, fprintf('Error (after BA): %f\n', info.err.BA);
45  else, fprintf(' %f\n', info.err.BA); end
46else, if ~opt.verbose, fprintf('\n'); end; end
Note: See TracBrowser for help on using the repository browser.