Using imwrite without screen capturing

Hello,
I'm trying to make a movie with matlab (2010a). I generate frames with my script and then use imwrite to save them to files, eg 'frame-001.png', 'frame-002.png', etc.
My problem is that if I have another window over the matlab figure that call imwrite on I get an image of the window that's over the figure... which is insane.
The movie I'm trying to make has thousands of frames so it takes hours to make, so when the screensaver comes on I get a bunch of black frames even.
Is there a better to do this?
EDIT:
mapshow(...)
mapshow(...)
[im, map] = frame2im(getframe);
imnum = sprintf('%04d', ii);
imwrite(im, ['frames/frame-' imnum '.png'], 'png');
This is offending code snippet. It's probably getframe that's causing the problem.

1 件のコメント

Sean de Wolski
Sean de Wolski 2011 年 9 月 14 日
Can you show us the code? There is definitely a way to save without this issue and I've never seen it. Are you printing the screen? What are you imwriting? Have you looked at saveas?

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

 採用された回答

Sean de Wolski
Sean de Wolski 2011 年 9 月 14 日

1 投票

look at saveas
doc saveas

その他の回答 (1 件)

Jan
Jan 2011 年 9 月 14 日

0 投票

No, there is no better way. Disable the screen saver (e.g. by using the command system('powercfg') under Windows and avoid to cover the recorded window.
Do you re-use the existing window? This is much faster than creating a new FIGURE for each frame.

2 件のコメント

Devin
Devin 2011 年 9 月 14 日
I don't use windows. I shouldn't have to change my screen saver settings to get this to work. And finally, I should be able to use to machine to do other things while I wait for this.
Jan
Jan 2011 年 9 月 14 日
@Devin: Are we talking about what you *want* to do or what *has to be done* to solve it using Matlab?
I think it is not surprising, that a tool, which creates copies of the contents of the screen, is influenced by the contents of the screen. And if a task occupies the computer, it occupies the computer. Worrying does not increase the usability.

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

カテゴリ

ヘルプ センター および File ExchangeProgramming についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by