How to preset frame size with Videowriter?

11 vues (au cours des 30 derniers jours)
Paschalis Garouniatis
Paschalis Garouniatis le 18 Oct 2020
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 commentaire
Ameer Hamza
Ameer Hamza le 19 Oct 2020
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.

Connectez-vous pour commenter.

Réponses (1)

Ameer Hamza
Ameer Hamza le 19 Oct 2020
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'

Catégories

En savoir plus sur Animation dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by