How to preset frame size with Videowriter?

16 次查看(过去 30 天)
I am using getframe and videowriter functions in my code. I know that the frame size of the first frame will set the size for every other frame. Because of this fact (if i am not mistaken) I am getting the following error.
Error using VideoWriter/writeVideo (line 356)
Frame must be 545 by 672
I would like to know if there is a way to overcome this problem. Does presetting the frame size solves it? And if it does how can I do it? Is there another solution?
Thanks in advance!
  1 个评论
Ameer Hamza
Ameer Hamza 2020-10-19
Can you show how you are getting the frames from your figure? If your axes is changing its size and use are use getfame(gca), then you will have this issue.

请先登录,再进行评论。

回答(1 个)

Ameer Hamza
Ameer Hamza 2020-10-19
In your code, try to apply getframe on figure instead of axes
getframe(gcf);
otherwise fix the axis limits
ax = gca;
ax.XLimMode = 'manual';
ax.YLimMode = 'manual'
ax.ZLimMode = 'manual'

类别

Help CenterFile Exchange 中查找有关 2-D and 3-D Plots 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by