getframe in MATLAB movie
6 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Antworten (2)
Jan
am 2 Apr. 2013
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 Kommentare
Mahdi
am 2 Apr. 2013
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 Kommentare
Mahdi
am 2 Apr. 2013
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
...
Siehe auch
Kategorien
Mehr zu ActiveX finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!