Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

New to MATLAB?

Thread Subject:
avifile getframe screensaver problems

Subject: avifile getframe screensaver problems

From: Christopher

Date: 16 Jul, 2010 03:15:22

Message: 1 of 2


I'm running MATLAB R2009a on 64-bit Windows. I'm trying to create an AVI file from some grayscale images, which I've displayed with imshow() and then have added a few white symbols with plot(). As far as I know, the only codecs I have available are 'RLE', 'MSVC' and 'IYUV'. I have been able to create a movie using an avifile object with 'RLE' compression. Because 'RLE' (and 'MSVC') do not support true color, I have been calling getframe(gcf), and then selecting just one color channel (red) of the cdata, and then passing that frame to addframe. I am very happy with the results, in terms of the file size and image quality.

However, if I do other work while the movie is being created (I estimate it will take about an hour) or if the screensaver kicks in (as is required at my workplace after 10 minutes) this overwrites my movie frames because of the way getframe operates.

I have read Technical Solution 1-3NMHJ5 and Tech Note 1204, but so far:

Using ADDFRAME with the handle to the figure to add the frame to the AVI object does not work for 'RLE' or 'MSVC' compression, which do not handle true color. It also does not work for 'IYUV' compression. (I get other warning messages that 'IYUV' is not supported.) Is there a way to make the figure grayscale so it can be passed to addframe() with my avifile object?

print() and imread() are very slow (I have thousands of frames) and also the quality of the image is not preserved, at least when I 'print -dbmp256'. Is there a better format to use in the print command?

I haven't tried the hardcopy() method, because I'm not really sure how to adapt that to my configuration (i.e. what's my renderer?) and it appears as this option is only recommended as a last resort.

Any suggestions would be appreciated.

Thanks in advance,

Subject: avifile getframe screensaver problems

From: Christopher

Date: 16 Jul, 2010 23:57:03

Message: 2 of 2


FYI, I solved my problem using alternative 3 in Technical Solution 1-3NMHJ5, i.e. by using the undocumented HARDCOPY feature. It turns out it was very simple to set the renderer for my figure. For my case, the 'zbuffer' renderer was faster than the 'OpenGL' renderer.

I would still be interested in hearing other solutions or optimizations to my method.


Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us