-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathg_record.m
55 lines (42 loc) · 1.76 KB
/
g_record.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
function g_record
global goose
if ~goose.current.isrecording
[filename, pathname] = uiputfile('test.avi','Save as...');
goose.video.filename = filename;
goose.video.pathname = pathname;
if all(filename == 0) || all(pathname == 0)
return;
end
stop(goose.video.vidobj);
triggerconfig(goose.video.vidobj, 'immediate')
set(goose.video.vidobj,'TriggerRepeat',Inf)
set(goose.video.vidobj,'LoggingMode','disk&memory');
file = avifile(fullfile(pathname, filename), 'fps',25,'Compression','Indeo5','quality',100,'keyframe',20);
set(goose.video.vidobj,'DiskLogger',file);
start(goose.video.vidobj);
goose.current.isrecording = 1;
set(goose.gui.butt_rec,'String','stop');
else %isrecording
stop(goose.video.vidobj);
if goose.current.isrecording
while goose.video.vidobj.FramesAcquired > goose.video.vidobj.DiskLoggerFrameCount
pause(.1)
end
aviobj = close(goose.video.vidobj.DiskLogger);
goose.current.isrecording = 0;
set(goose.gui.text_video,'String',[num2str(goose.video.time),' sec, ',num2str(goose.video.nFrames), ' frames (',num2str(goose.video.Width),' x ',num2str(goose.video.Height),' at ',num2str(goose.video.fps),' fps)'])
end
delete(goose.video.vidobj)
goose.video.vidobj = [];
set(goose.gui.butt_rec,'Enable','off');
done_idx = find(goose.analysis.framedone);
g_open(1, goose.video.filename, goose.video.pathname);
for iFrame = done_idx
goose.current.iFrame = iFrame;
g_analyze(1);
end
set(goose.gui.butt_rec,'String','record');
set(goose.gui.butt_play,'enable','on');
set(goose.gui.menu_5c,'Enable','off');
set(goose.gui.menu_5d,'Enable','on');
end