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?

 채택된 답변

Chad Greene
Chad Greene 2013년 8월 12일

1 개 추천

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

댓글 수: 1

Michael Benton
Michael Benton 2019년 12월 16일
this no longer works, has anyone found a newer solution?

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Sean de Wolski
Sean de Wolski 2013년 8월 9일

0 개 추천

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

댓글 수: 5

Chad Greene
Chad Greene 2013년 8월 9일
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 2013년 8월 9일
I'd be curious to see a reproducible example.
Chad Greene
Chad Greene 2013년 8월 9일
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 2013년 8월 9일
random values!
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);

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Animation에 대해 자세히 알아보기

질문:

2013년 8월 9일

댓글:

2019년 12월 16일

Community Treasure Hunt

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

Start Hunting!

Translated by