I'm using the VideoWriter feature for a simple animation of motion of a 3-D surface. Running through the loop, I can see in my figure window that the plot looks great, but something in the process is removing several dozen pixels bounding the entire figure. The result is that I only see a small corner of the axes. Is getframe trimming away my edges? How can I fix it?

 Respuesta aceptada

Chad Greene
Chad Greene el 12 de Ag. de 2013

1 voto

I figured out the fix:
getframe(gcf,[left bottom width height]),
using the figure position from get(gcf).

1 comentario

Michael Benton
Michael Benton el 16 de Dic. de 2019
this no longer works, has anyone found a newer solution?

Iniciar sesión para comentar.

Más respuestas (1)

Sean de Wolski
Sean de Wolski el 9 de Ag. de 2013

0 votos

I would guess getframe ios the culprit. Try cycling through the renderers - I would start with 'Painters'
set(gcf,'renderer','painters')

5 comentarios

Chad Greene
Chad Greene el 9 de Ag. de 2013
Hi Sean,
Thanks for the suggestion--I've tried painters, zbuffer, and opengl, all with the same results. Any other ideas?
Chad
Sean de Wolski
Sean de Wolski el 9 de Ag. de 2013
I'd be curious to see a reproducible example.
Chad Greene
Chad Greene el 9 de Ag. de 2013
Hmm, this animation is built on some proprietary data that would mean nothing to anyone who is listening, but would be against lab policy for me to distribute. I'll see if I can work up a reproducible fake example.
Sean de Wolski
Sean de Wolski el 9 de Ag. de 2013
random values!
Chad Greene
Chad Greene el 9 de Ag. de 2013
The problem is evident here. The title is gone, as are bits of the x and y axes.
figure
mov = VideoWriter('examplemovie');
mov.FrameRate = 12;
open(mov)
for n = 1:20
h=surf(peaks+sin(n))
title(['frame number ',num2str(n)])
frame = getframe;
writeVideo(mov,frame);
delete(h);
end
close(mov);

Iniciar sesión para comentar.

Categorías

Más información sobre Animation en Centro de ayuda y File Exchange.

Preguntada:

el 9 de Ag. de 2013

Comentada:

el 16 de Dic. de 2019

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by