getframe in MATLAB movie
5 ビュー (過去 30 日間)
古いコメントを表示
I am creating a movie from MATLAB figures. When I call getframe, it "usually" captures the plot image, but from today if there is something else active on the screen (which is normal if I continue to use the computer) it captures whatever window is active. Is there another way to grab the image of the active figure? Somebody knows what happened?
the scheme to create the movie is:
wobj = VideoWriter(); f=figure();
open(wobj);
for.....
F=getframe(gcf); writeVideo(wobj,F);
end....
close(wobj);
0 件のコメント
回答 (2 件)
Jan
2013 年 4 月 2 日
GETFRAME captures the screen contents inside the figure coordinates. If another window is in the foreground, the original figure is hidden.
The print command is not limited in this way, but it does not create pixel-exact copies in consequence. If this does not bother you, print to a PNG and import the files afterwards to create the movie.
0 件のコメント
Mahdi
2013 年 4 月 2 日
Just set your getframe(gcf) to whichever window you want to capture.
For example, if you want to capture the plot in figure 1, you would use
getframe(1)
and so on. gcf is basically the "handle" to the figure. Using gcf on its own just uses the active window.
2 件のコメント
Mahdi
2013 年 4 月 2 日
To make it more clear, look at the lines that I suggested modifying.
wobj=VideoWriter();
f=figure(1); % This line
open(wobj);
for ...
F=getframe(1) % And this line
...
参考
カテゴリ
Help Center および File Exchange で Animation についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!