-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathParameterSetup.m
65 lines (48 loc) · 1.89 KB
/
ParameterSetup.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
%% Initialize
% clear workspace, add path, make settings for tracking
clear
clc
addpath(genpath(pwd))
makeSettings;
%% Load Video data and corresponding metadata
[Settings.FileName, Settings.PathName] = uigetfile(fullfile(Settings.default_video_path,'*.*'),'Select video file');
Settings.Video = fullfile(Settings.PathName,Settings.FileName);
% Metadata required for tracking are the Video width and heigth and the
% number of frames in the video. Those are native properties of video
% objects, but not in costum data files like our .dat format. In our case
% we load a second file containing metadata.
if Settings.use_external_specfile
try
m_file = fullfile(Settings.PathName,Settings.FileName);
m_file(end-2) = 'm';
load(m_file)
Settings.Video_width = Data.Resolution(1);
Settings.Video_heigth = Data.Resolution(2);
Settings.Nframes = Data.NFrames;
catch
disp('Make sure to turn of --use external specfile-- in settings or update the section loading the video specifications.')
return
end
else
try
Video_object = VideoReader(Settings.Video);
Settings.Video_width = Video_object.Height;
Settings.Video_heigth = Video_object.Width;
Settings.Nframes = floor(Video_object.Duration * Video_object.FrameRate);
Settings.Video_object = Video_object;
catch
disp('The Video is not readable with ''VideoReader''')
return
end
end
%% Data Tracking and display
% Track Objects and Nose
[Output.Objects,Settings.object_threshold] = ObjectDetection(Settings);
Output = TrackNose(Settings, Output);
% Open a GUI to display results of tracking on a single frame
Settings.definite_settings = 0;
while Settings.definite_settings == 0
Settings = FrameSelection(Settings);
Settings = TrackingParameters(Settings, Output);
end
save(Settings.matout_name ,'Output','Settings')