-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathrunOnLightfields.m
51 lines (46 loc) · 1.36 KB
/
runOnLightfields.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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
%%
%% Run the depth estimation code on multiple lightfields,
%% saving results to file.
%%
function runOnLightfields (D)
addpath('./util', './lines', './depth', './cviewDepthEstim', './cviewDepthEstim/wmf', ...
'./angularDiffusion');
if isempty(D{1})
disp('Error! No input specified. Please see README.md for help.');
return;
end
% Results are saved in a a folder with the current timestamp as the name
%
tstamp = datestr(datetime, 'dd-mmm-yyyy HHMM');
tstamp( isspace(tstamp) ) = '_';
folder = ['./results/' tstamp 'hrs'];
mkdir(folder);
% The output file the name is the name of the light field
fout = {};
for i = 1:length(D)
[filepath, name, ext] = fileparts( D{i} );
if isempty(ext)
str = D{i};
if str(end) == '/'
str(end) = [];
end
s = strsplit(str, '/');
fout{i} = s{end};
else
disp('Input Error! Please provide a path to the folder containing light field images');
end
end
% Run parameters
% Change these to evaluate the output with different settings for different light fields
param = parameters;
% Initialize Matlab's parpool
cluster = parcluster('local');
cluster.NumWorkers = param.nWorkers;
saveProfile(cluster);
delete(gcp('nocreate'));
parpool(param.nWorkers);
% Run...
for i = 1:length(D)
VCLFD( D{i}, [folder '/' fout{i}], param);
end
end