-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathtrackplotter.m
More file actions
50 lines (45 loc) · 1.31 KB
/
Copy pathtrackplotter.m
File metadata and controls
50 lines (45 loc) · 1.31 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
47
48
49
50
function trackplotter(annotations, background, outpath)
%TRACKPLOTTER Plots tag tracks on the background image
% Generates a summary image that
%
% SYNTAX
% trackplotter(annotations, vid, outpath)
%
% DESCRIPTION
% trackplotter(annotations, vid, outpath) specifies the annotations to
% summarize, the video handle to the video returned by vidpreproc.m, and
% the output video filename.
%
% AUTHOR
% Blair J. Rossetti
%
% DATE LAST MODIFIED
% 2016-06-23
% remove non-tags
data = annotations([annotations.istag]);
if isempty(data)
return
end
% define track colors
colors = lines(max([data.trackid]))*255;
% get tracks
tracks = unique([data.trackid]);
% insert tracks
figure = background;
for i = 1:length(tracks)
% for i = 3
track = data([data.trackid] == tracks(i));
coords = [track.centroid];
% sidx = 28;
% j=1;
% eidx = 70;
sidx = 1;
eidx = [find(diff([track.time]) >= 1) length([track.time])];
figure = insertMarker(figure, coords(1:2), 'square', 'Color', colors(tracks(i),:));
figure = insertMarker(figure, coords(end-1:end), 'circle', 'Color', colors(tracks(i),:));
for j = 1:length(eidx)
figure = insertShape(figure, 'Line', coords(2*sidx-1:2*eidx(j)), 'Color', colors(tracks(i),:));
sidx = eidx(j)+1;
end
end
imwrite(figure, outpath);