-
Notifications
You must be signed in to change notification settings - Fork 0
/
visualizeOFSeg.m
61 lines (52 loc) · 1.44 KB
/
visualizeOFSeg.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
function [] = visualizeOFSeg(data,centroid,theta,ifsave)
scale = 1;
l_ar = 50;
dims = size(data);
mi = min(data(:));
ma = scale*max(data(:));
hf = figure;
set(hf,'color','w');
if ifsave
c = clock;
writerobj = VideoWriter(['C:\Users\shuting\Desktop\temp\outputs\' ...
num2str(c(1)) num2str(c(2)) num2str(c(3)) num2str(c(4)) num2str(c(5))...
num2str(round(c(6))) '.avi']);
open(writerobj);
end
while true
for i = 1:dims(3)
imagesc(data(:,:,i),[mi ma]);
hold on;scatter(centroid(i,1),centroid(i,2),'r*');
quiver(centroid(i,1),centroid(i,2),cos(degtorad(theta(i)))*l_ar,...
-sin(degtorad(theta(i)))*l_ar,'b');
hold off;
title(['t=' num2str(i)]);
% title(num2str(theta(i)));
colormap(hot);
axis equal off tight
xlim([0 dims(1)]);ylim([0 dims(2)]);
keypressed = get(hf,'currentkey');
pause(0.01);
% if i==200
% i;
% end
if ifsave
F = getframe(hf);
writeVideo(writerobj,F);
end
if keypressed=='e'
close(hf);
return;
end
if i == dims(3)
if ifsave
close(writerobj);
close(hf);
return;
else
i = 1;
end
end
end
end
end