-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcomputeFeaturesCompiled.m
More file actions
29 lines (22 loc) · 883 Bytes
/
computeFeaturesCompiled.m
File metadata and controls
29 lines (22 loc) · 883 Bytes
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
function computeFeaturesCompiled(moviename,trackfilename,stationary,...
method,blocknum,blocksize,savename)
stationary = str2double(stationary);
blocknum = str2double(blocknum);
blocksize = str2double(blocksize);
tracks = load(trackfilename);
tracks = tracks.trx;
[readfcn,nframes,fid,headerinfo] = get_readframe_fcn(moviename);
fclose(fid);
ff = [tracks.firstframe];
ee = [tracks.endframe];
minfirst = min([tracks.firstframe]);
maxlast = max([tracks.endframe]);
nframes = maxlast-minfirst+1;
% compute features in parallel for different intervals of frames.
ndx = blocknum;
[readfcn,nframes,fid,headerinfo] = get_readframe_fcn(moviename);
fstart = minfirst + (ndx-1)*blocksize;
fend = min(maxlast,ndx*blocksize+minfirst-1);
curftrs = genFeatures(readfcn,headerinfo,fstart,fend,tracks,stationary,method);
fclose(fid);
save(sprintf('%s_%d.mat',savename,blocknum),'curftrs');