forked from anne-urai/Tools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathIlja_saveAVI.m
45 lines (37 loc) · 1.03 KB
/
Ilja_saveAVI.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
%# blank image
figure
zeroimage = zeros(799,799);
pal = [1 1 1; 0 0 0];
imshow(zeroimage);
colormap(pal);
set(gca, 'nextplot','replacechildren', 'Visible','off');
%# create AVI object
nFrames = 380;
vidObj = VideoWriter('GridIllusion.avi');
vidObj.Quality = 100;
vidObj.FrameRate = 2;
open(vidObj);
%# preallocate
writeVideo(vidObj, getframe(gca));
% make frames, customscript
middlepointX = [80 240 400 560 720];
middlepointY = [80 240 400 560 720];
zeroimage = zeros(799,799);
size = 4;
for b = 1:38
for c = 1:length(middlepointX);
x = middlepointX(c);
for d = 1:length(middlepointY);
y = middlepointY(d);
zeroimage(x-size/2:x+size/2, y-size/2:y+size/2) = 1;
end;
end;
size = size + 4;
imshow(zeroimage); %this is essential
colormap(pal); %this is essential
for g = 1:1
writeVideo(vidObj, getframe(gca)); %this is essential
end;
end;
close(gcf) %this is essential
close(vidObj); %this is essential