필터 지우기
필터 지우기

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 CenterFile Exchange에서 ActiveX에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by