getframe problem
26 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
i am trying to make a video clip (avi) from a sequence of surf plots.
i used the getframe function to capture a series of figures depicting an evolvement of some data. a clip is created (through writeVideo). when i run the clip, instead of the full moving video i get a still image of the first frame mixed with my own desktop background details. this is a mess up coming from getframe.
any suggestions why this happens and how it could be overcome?
thanks a lot
mat
0 Kommentare
Antworten (4)
Onomitra Ghosh
am 22 Mär. 2012
You can try the workarounds mentioned in:
1 Kommentar
Lauren
am 22 Nov. 2013
Hi Mat,
I was having the same problem you described. I used option 1 from the link above, and it seemed to solve the problem for me. In the code below, if I uncommented either of the two commented lines within the for loop, it would not work without changing the renderer to zbuffer. Once I added the line to set the renderer to zbuffer, I could uncomment either the surf or the mesh command in the for loop, and was able to produce the desired avi video clip.
clear all;
close all;
i_test = 25*pi/180;
theta = 0:0.1*pi:2*pi;
x_test = cos(theta);
y_test = cos(i_test)*sin(theta);
z_test = sin(i_test)*sin(theta);
[sphere_x,sphere_y,sphere_z] = sphere(25);
sphere_x = 0.5*sphere_x;
sphere_y = 0.5*sphere_y;
sphere_z = 0.5*sphere_z;
figure;
axis([-1.5,1.5,-1.5,1.5,-1.5,1.5]);
axis square;
title Title;
xlabel x; ylabel y; zlabel z;
hold on;
set(gcf,'Renderer','zbuffer')
k_test = 1;
for t = 0:0.01*pi:2*pi
cla;
plot3(x_test,y_test,z_test,'-r',cos(t),cos(i_test)*sin(t),...
sin(i_test)*sin(t),'ok');
% surf(sphere_x,sphere_y,sphere_z,'EdgeColor','black',...
% 'FaceColor',[0,.5,0]);
% mesh(sphere_x,sphere_y,sphere_z,'EdgeColor',[0,.5,0]);
text(.6,-1.2,-1,['t = ' num2str(t)]);
testMovie(k_test) = getframe(gcf);
k_test = k_test + 1;
end
Jan
am 22 Mär. 2012
I had some success with adding a pause(0.02) before the getframe call. Using drawnow only helped in 99% of the pictures only.
0 Kommentare
Jeremy
am 1 Dez. 2015
Bearbeitet: Jeremy
am 1 Dez. 2015
I'm having a similar problem, when I call movie(F), I get only the first frame of the video, then the call to movie ends. (Matlab 2015b, on Mac OS X 10.10.5). Any ideas?
(Also, the frame it shows is off center on the plot and partially hidden, not sure if this is relevant or not)
***Update: Never mind, I was accidentally skipping frames, so my F matrix had only every fourth entry filled in, I guess the empty entries stopped it.
0 Kommentare
Siehe auch
Kategorien
Mehr zu Audio and Video Data finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!