VideoWriter -- trouble creating the example peaks.avi
古いコメントを表示
Windows 7, 64-bit, Matlab R2011a...
I tried running the following code from the VideoWriter examples...
vidObj = VideoWriter('peaks.avi');
open(vidObj);
Z = peaks; surf(Z);
axis tight
set(gca,'nextplot','replacechildren');
for k = 1:20
surf(sin(2*pi*k/20)*Z,Z)
currFrame = getframe;
writeVideo(vidObj,currFrame);
end
close(vidObj);
This resulted in a faded still image of the first frame. Weirdly, my desktop behind the figure is also visible. I tried...
vidObj = VideoWriter('peaks.avi','Uncompressed AVI');
...which resulted in a video that looked sort of like a scrambled color TV set. Any ideas? Thanks in advance...
3 件のコメント
Sven
2011 年 10 月 29 日
I don't think that this is a "VideoWriter" problem as much as it's a getframe() problem.
I believe that if you were to view the image captured into currFrame, it will look just as bad as the video. In other words, VideoWriter is working well, but it's being fed bad images.
The question of what to do next is a tricky one. I myself have lots of trouble with getframe() in this specific situation:
1. Using Windows Vista or Win7 (XP has no probs ok)
2. Capturing a 3D object (patch)
Are you using win7?
Walter Roberson
2011 年 10 月 29 日
You could try putting a pause() in after the surf and before the getframe(). That will force a render update, and will give some time for that update to finish.
Justin Bailey
2011 年 10 月 29 日
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Creating, Deleting, and Querying Graphics Objects についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!