-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAnimateKeyPeriods.m
More file actions
46 lines (32 loc) · 1.41 KB
/
AnimateKeyPeriods.m
File metadata and controls
46 lines (32 loc) · 1.41 KB
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
%% Produce animations of key periods
%% Setup
% Add required directories (and subdirectories)
addpath(genpath('functions'))
addpath(genpath('inputs'))
% Read input parameters
Config = HurunuiAnalysisConfig;
%% Load data
% Read image data (processed by ImageAnalysis)
load('outputs\PhotoDatabase.mat');
load('outputs\ShortlistPhotos.mat')
% Read time series data (already processed by TimeseriesAnalysis)
LagoonTS = readtable('outputs\LagoonTS.csv');
LagoonTS.DateTime = datetime(LagoonTS.DateTime);
%% Generate videos
Alphabet = num2cell('ABCDEFGHIJKLMNOPQRSTUVWXYZ');
OutputFolder = fullfile('outputs', 'videos');
if ~exist(OutputFolder,'dir')
mkdir(OutputFolder);
end
for PeriodNo = 1:size(Config.KeyPeriods,1)
fprintf('Producing video for period %s\n', Alphabet{PeriodNo})
PhotoSelectMask = ShortlistPhotos.UniqueTime >= Config.KeyPeriods(PeriodNo,1) & ...
ShortlistPhotos.UniqueTime <= Config.KeyPeriods(PeriodNo,2);
PhotosForVideo = ShortlistPhotos(PhotoSelectMask, :);
FileName = sprintf('Period%s_%s', Alphabet{PeriodNo}, ...
datestr(Config.KeyPeriods(PeriodNo,1),'yyyy-mm-dd'));
FileName = fullfile(OutputFolder, FileName);
animatePhotos(FileName, ...
fullfile(Config.DataFolder,Config.PhotoFolder), Photos, ...
PhotosForVideo, Config, LagoonTS, 12, true);
end