フィルターのクリア

getframe in MATLAB movie

6 ビュー (過去 30 日間)
Francesco
Francesco 2013 年 4 月 2 日
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);

回答 (2 件)

Jan
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.

Mahdi
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
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
...
Francesco
Francesco 2013 年 4 月 2 日
I tried it but it does not work... It is a strange thing, because with the code that I wrote above, yesterday it worked today no. Thanks

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeActiveX についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by