Why do i get error in videowriter as "Error using VideoWriter/writeVideo Frame must be 436 by 344 Error in videoominusone (lwriteVideo(writerObj,getframe(gca));"
39 次查看(过去 30 天)
显示 更早的评论
Please help me to solve this errror
Error using VideoWriter/writeVideo (line 383)
Frame must be 436 by 344
Error in videoominusone (line 286)
writeVideo(writerObj,getframe(gca));
0 个评论
采纳的回答
Walter Roberson
2015-7-13
Every frame that you write with VideoWriter must be the exact same size.
getframe(gca) returns according to the current axes size. If you have not taken special care, that axes size will not necessarily be exactly the same size as the previous frame.
You should be considering setting up the axes once and using "hold on", and then updating only the content of the axes. Your current code likely rebuilds the axes each time through your loop.
1 个评论
James Marron
2023-8-30
Had this problem, which was caused by first creating an image, and then plotting additional graphics on top, within each frame. Sometimes the additional graphic would extend beyond the image which would then extend the axes beyond hte original image. The function getframe would still contruct a movie structure (with indeed difernt sizes of cdata in different frames). That seemed to generate this error when VidoWriter was called. The solution for me was:
- After creating the image part, but before adding the additional graphics, store the axis limits, wth a command like "vaxlim = axis;"
- Add the additional graphcs
- Restore the orginal axis limits useing "axis(vaxlim);"
更多回答(0 个)
另请参阅
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!