-
Notifications
You must be signed in to change notification settings - Fork 0
/
analyzeDropouts.m
40 lines (28 loc) · 980 Bytes
/
analyzeDropouts.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
% get image timestamps for a set of videos, compare time stamps, dropout
% rate, dropout times, etc.
video_folder = 'D:\Lab\Data\DLC_videos\Han_20201223_rwTwoPlanes\videos\';
video_list = dir([video_folder,'*.avi.xiinfo*']);
%%
vid_idx = 5;
fid = fopen([video_list(vid_idx).folder,filesep,video_list(vid_idx).name]);
first_frame_val = -1;
tline = fgetl(fid);
timestamps = [];
while ischar(tline)
% check if timestamp data
is_timestamp = ~isempty(strfind(tline,'timestamp'));
if(is_timestamp)
% number is between two quotes
quote_idx = strfind(tline,'"');
timestamp_temp = str2num(tline(quote_idx(1)+1:quote_idx(2)-1));
if(first_frame_val < 0 && timestamp_temp > 0)
first_frame_val = timestamp_temp;
end
if(timestamp_temp > 0)
timestamps(end+1) = timestamp_temp-first_frame_val;
end
end
tline = fgetl(fid);
end
fclose(fid);
% histogram(diff(timestamps))