How to use getframe without displaying the figure?

Hi,
I am trying to use getframe without displaying the figure. I have read it is impossible because getframe needs the figure to be displayed. So the following code does not work:
figure('visible', 'off')
Do you have any idea how to do that? At least prevent the figure from popping up and display it "behind" the Matlab main window?

2 commentaires

Hi,
I tried the following in MATLAB R2015b and R2016a and this worked fine where getframe was able to capture the figure without popping up the figure window.
f = figure('visible', 'off');
plot(rand(5))
F = getframe(gca);
Further to display the captured figure, see below:
figure;
imshow(F.cdata)
Can you share the reproduction code and the version of MATLAB you are working on?
Hi, it works fine. But I noticed it takes 4 TIMES longer when you DON'T VISUALIZE the output. Weird.

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur Creating, Deleting, and Querying Graphics Objects dans Centre d'aide et File Exchange

Question posée :

le 5 Avr 2016

Commenté :

le 27 Oct 2017

Community Treasure Hunt

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

Start Hunting!

Translated by