-
Notifications
You must be signed in to change notification settings - Fork 4
/
demo_bundle_optimization.m
30 lines (25 loc) · 1017 Bytes
/
demo_bundle_optimization.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
clc; clear; close all;
addpath('./src');
addpath(genpath('./toolbox'));
%% set parameters
opt = DefParam('bundle');
dataset = {'Road', 'Lawn', 'Flower'}; id = 2;
video_root = sprintf('./video/%s', dataset{id});
initmt_root = sprintf('./result/init/%s', dataset{id});
result_root = sprintf('./result/bundle_p1/%s', dataset{id});
% % uncomment to run the second pass
% initmt_root = sprintf('./result/bundle_p%d/%s', dataset{id}, 1);
% result_root = sprintf('./result/bundle_p%d/%s', dataset{id}, 2);
%% init parameters
cameras_txt_path = fullfile(video_root, 'cameras.txt');
[imPath, ~] = GetFileList(fullfile(video_root, 'src'), 'jpg');
[lbPath, ~] = GetFileList(initmt_root, 'mat');
makedir(result_root);
%% decode camera parameters
fprintf('- decoding camera parameters ...\n');
cam = decode_cameras_txt(cameras_txt_path);
%% solve disparity initialization
fprintf('- doing disparity initialization ...\n');
opt.result_root = result_root;
optimize_bundle(imPath, lbPath, cam, opt);
fprintf('- finished.\n');