Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

how to hide figures with getframe

669 views
Skip to first unread message

Rudi Schuech

unread,
Jul 12, 2006, 3:02:49 PM7/12/06
to
I am making avi videos with the following code:

for loop

fig1 = figure(1)

delete(gca) % necessary to get rid of old isosurfaces
isosurface( ..... )
set(fig1,'DoubleBuffer','on')
set(gca,'nextplot','replace','Visible','on')
title( ... )
set(gca,'ylim', ... , 'xlim', .......)

frame = getframe(gcf)
aviobj1 = addframe(aviobj1,frame)

end for loop

This results in each new frame displaying on the screen and being
captured, as long as the window is in focus. If it isn't, the
topmost window gets added to the video instead.

I'd like to make the process run in the background, so no figure is
ever displayed on the screen but the video is still created. I'd
also like to solve the window focus problem. Any movie format would
be OK instead of avi, but it would be nice to be able to play it
without Matlab.

I've tried setting "visible" "off" but it seems that the "getframe"
function overrides this and brings up the figure anyway.

Thanks for any help,
Rudi

Rudi Schuech

unread,
Jul 13, 2006, 8:02:46 PM7/13/06
to
Answered my own question:

I realized you don't actually need getframe(). I now just insert the
figure handle (fig1) instead of the frame in addframe(aviobj1,
fig1),and set visibility 'off' when creating the figure.

Erik

unread,
Jul 28, 2010, 5:24:04 AM7/28/10
to
I'm having the same problem, however, Rudi's solution does not work for me:

There is a difference between passing the figure handle and passing the frame (besides making it run in the background when 'visible' is set to 'off').

I get a small, skewed and striated movie when I pass the figure handle... So my question, is there another way to hide frames when making a movie?

Regards,

Erik

"Rudi Schuech" <atomict...@aim.com> wrote in message <ef3b...@webcrossing.raydaftYaTP>...

Oliver Woodford

unread,
Jul 28, 2010, 5:59:04 AM7/28/10
to
"Erik" wrote:
> Is there another way to hide frames when making a movie?

Make the figure invisible, then use print/saveas to export the figure - write to TIFF, then read it back in.

Export_fig (http://www.mathworks.com/matlabcentral/fileexchange/23629-exportfig) can do this for you, providing all the settings for faithful reproduction:
frame = export_fig(fig_handle, '-nocrop', '-a1');
It will even anti-alias the output, if you like, e.g. using '-a3'.

Erik

unread,
Jul 28, 2010, 7:13:04 AM7/28/10
to
Hi Oliver,

I'll see if I can make that work, it does sound like it might take more time than actually just letting the frames pop up.

Erik

"Oliver Woodford" <o.j.woo...@cantab.net> wrote in message <i2ov18$mpt$1...@fred.mathworks.com>...

0 new messages