[vtkusers] offline animations
    Ravi Gupta 
    rgupta at imaging.robarts.ca
       
    Tue Dec  9 10:26:28 EST 2003
    
    
  
Two more methods to convert image frames into a movie:
- Use ImageJ, loads a directory of frames and writes out an uncompressed 
  movie.
http://rsb.info.nih.gov/ij/index.html - OSX, Mac, Linux, Win.
- Use Matlab
A Matlab script is below.
Suppose 319 TIFF files are to be used as SEQUENTIAL frames in a movie. 
Assume
that the files are named Main10xxx.tif, where xxx = 100, 101, ..., 418, 
and are
stored in the "/scratch/tiff" directory.
First, generate a Matlab-format movie, and then convert to AVI format.
--------------------------------------------------------------
for i = 100:418,
       % Read the file Main10xxx.tif, where xxx = 100, 101, ..., 418.
       % First, create the command.  This must be done because the file name
    % is parameterized by i (= 100, 101, ..., 418).
    cmd = sprintf('img = imread(''/scratch/tiff/Main10%d.tif'');', i);
       % Run the command.
    eval(cmd);
       % Store the frame in a movie called "M0".    % Note that the 
movie need not be pre-allocated.
    % Use "im2frame" instead of "getframe" to avoid image boundary 
artifacts.
    M0(i-100+1) = im2frame(img);   end
% Convert to avi.
% On Windows, there are several compression options.
% On Linux/Unix, there are no compression options.
% However, the Matlab movie (in this case, M0), can be saved as a
% *.mat file, and converted on a Windows machine.
movie2avi(M0, 'M0.avi');
Matthijs Sypkens Smit wrote:
> On Tuesday 09 December 2003 13:21, Luke J West wrote:
> 
> 
>>I want to make an mpeg or animated gif (or other format - whatever)
>>from a series of scenes generated when I invoke the Render() method.
>>
>>How might I do this in a LINUX/UNIX environment?
> 
> 
> I have personally used the ImageWriter (PNG, JPEG, etc.) classes to output 
> individual frames to the hard drive together with the mjpegtools ( 
> http://mjpeg.sourceforge.net/ ) to combine the frames into movies. I don't 
> know if there is a better or easier way than that, but it works reasonably 
> well.
> 
> 
-- 
Ravi Gupta
Programmer
###################################################
Robarts Research - Imaging	  | 100 Perth Drive
Tel: (519) 663-5777 ext. 1-34077  | London, Ontario
Fax: (519) 663-3403		  | N6A 5K8
E-Mail: rgupta at imaging.robarts.ca | Canada
###################################################
###################################################
http://www.imaging.robarts.ca/
http://www.imaging.robarts.ca/coders	
http://www.imaging.robarts.ca/~rgupta
###################################################
"Be the change you wish to see in the world."
-Mohandas Karamchand Gandhi
    
    
More information about the vtkusers
mailing list