-
Notifications
You must be signed in to change notification settings - Fork 24
/
Copy pathdemo.m
68 lines (56 loc) · 2.36 KB
/
demo.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
%% Run this demo script to step through the included reconstruction procedures
% Assumes MATLAB R2016b or higher (lower versions may work but have not
% been tested).
addpath('./util');
% First, run FBP, LCT, and f-k migration reconstructions for one of the
% captured datasets
% Optionally replace the below filenames with files from other scenes:
% bike, discoball, dragon, outdoor, resolution, statue, teaser
load('statue/tof.mat');
load('statue/meas_10min.mat');
% resize to low resolution to reduce memory requirements
measlr = imresize3d(meas, 128, 128, 2048); % y, x, t
tofgridlr = imresize(tofgrid, [128, 128]);
wall_size = 2; % scanned area is 2 m x 2 m
% run FBP
fprintf('\nRunning FBP\n');
algorithm = 0;
fbp = cnlos_reconstruction(measlr, tofgridlr, wall_size, algorithm);
% run LCT
fprintf('\nRunning LCT\n');
algorithm = 1;
lct = cnlos_reconstruction(measlr, tofgridlr, wall_size, algorithm);
% run f-k migration
fprintf('\nRunning f-k migration\n');
algorithm = 2;
fk = cnlos_reconstruction(measlr, tofgridlr, wall_size, algorithm);
% run phasor fields reconstruction by Liu et al.
% (https://www.nature.com/articles/s41586-019-1461-3)
fprintf('\nRunning phasor fields\n');
algorithm = 3;
fk = cnlos_reconstruction(measlr, tofgridlr, wall_size, algorithm);
%% Reconstruct a frame from the interactive results
% perform reconstruction and visualization for 32 x 32 resolution scene
% captured at 4 Hz
fprintf('\nReconstructing interactive results\n');
% this processes the frame, but it could also be directly loaded from the
% preprocessed version in 'interactive/fk_32.mat'
load('interactive/meas_32.mat');
load('interactive/tof_32.mat');
v = VideoReader('interactive/video_32.mov');
video_idx = 1400;
frame_idx = 73;
frame = squeeze(meas(frame_idx, :, :, :));
crop = 1024; % crop measurements to 1024 bins
cnlos_reconstruction(frame, tofgrid, wall_size, algorithm, crop);
figure; imshow(read(v, video_idx),'InitialMagnification', 20);
title('Photo of interactive capture');
clear v;
%% Run non-planar reconstruction
% reconstruction of a scene from a scanned non-planar surface
fprintf('\nRunning non-planar reconstructions\n');
nonplanar_reconstruction;
%% Run phase retrieval
% run the phase retrieval algorithm on one of the captured datasets
fprintf('\nRunning phase-retrieval reconstruction\n');
hio_reconstruction;