Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: compiling images into a video
Date: Tue, 20 Oct 2009 22:42:03 +0000 (UTC)
Organization: Universit&#228;t Heidelberg
Lines: 24
Message-ID: <hblebr$98k$1@fred.mathworks.com>
References: <hbkvp0$2tu$1@fred.mathworks.com> <hbl2ms$j96$1@fred.mathworks.com> <hbl78t$ikr$1@fred.mathworks.com> <hblat6$k7q$1@fred.mathworks.com> <hblbhq$34q$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-05-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1256078523 9492 172.30.248.35 (20 Oct 2009 22:42:03 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Tue, 20 Oct 2009 22:42:03 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 869888
Xref: news.mathworks.com comp.soft-sys.matlab:578826


Dear Jimmy!

> I mean a simple video format such as avi which follows the sequence of the images  from image 1 to image 9.  

There may be better solution than doing this in Matlab. Especially the AVI-encoder may not macth the optimal quality. But it works, of course:

  % List of files (or any other trick to get the file names dynamically):
  ImageList = {'ImageFile1.tif', 'ImageFile2.tif', 'ImageFile3.tif', ...
    'ImageFile4.tif', 'ImageFile5.tif', 'ImageFile6.tif', ...
    'ImageFile7.tif', 'ImageFile8.tif', 'ImageFile9.tif'};

  AVI = avifile('D:\The9Pic.avi', 'FPS', 1, 'Compression', 'none');
  for iImage = 1:9
    aImage = imread(ImageList{iImage});
    AVI = addframe(AVI, aImage);
  end
  close(AVI);

See help of AVIFILE for more parameters.
This code can fail, if the TIFF is encode with CMYK colors, and a lot of further problems can appear. But for 24bit RGB images the AVI creation should work directly. Please try it.

Note: WindowsXP (to be exact: MediaPlayer) has problems to play an AVI from the TEMP folder. The error message was excellent: "Cannot find compressor." Moving the AVI outside the TEMP directory solved the problem immediately. Funny.

Good night, Jan