ANIM_MAKE makes a movie from the frames prepared by ANIM_FRAME using PPM2FLI. We speed things up a lot by using IMWRITE to write PCX files and convert them later to PPM, instead of writing PPM files directly, which is slow. Usage: []=anim_make; Example: peaks(40); [ax,el]=view; for i=1:9 view(ax,el+i*2); %STEP 1. Make each frame with ANIM_FRAME, supplying movie prefix anim_frame('peaks',i); end %STEP 2. Make the frames into a FLC with ANIM_MAKE anim_make This version uses PCX images as input, which requires a PCX to PPM convertor for PPM2FLI to work. "ppm2fli" is available at http://vento.pi.tu-berlin.du/ppm2fli/main.html Two free, popular programs that will convert PCX to PPM are: 1. "pcxtoppm", part of the NetPBM image freeware toolkit, available at: ftp://ftp.wustl.edu/graphics/graphics/packages/NetPBM/ OR 2. "convert", part of the ImageMagick image package available at: http://www.wizards.dupont.com/cristy/ImageMagick.html Some binaries are available for popular platforms -- you might want to check this first.
0001 function anim_make; 0002 % ANIM_MAKE makes a movie from the frames prepared by ANIM_FRAME 0003 % using PPM2FLI. We speed things up a lot by using IMWRITE to write 0004 % PCX files and convert them later to PPM, instead of writing PPM files 0005 % directly, which is slow. 0006 % 0007 % Usage: []=anim_make; 0008 % 0009 % Example: 0010 % peaks(40); 0011 % [ax,el]=view; 0012 % 0013 % for i=1:9 0014 % view(ax,el+i*2); 0015 % 0016 % %STEP 1. Make each frame with ANIM_FRAME, supplying movie prefix 0017 % anim_frame('peaks',i); 0018 % 0019 % end 0020 % 0021 % %STEP 2. Make the frames into a FLC with ANIM_MAKE 0022 % anim_make 0023 % 0024 % 0025 % This version uses PCX images as input, which requires 0026 % a PCX to PPM convertor for PPM2FLI to work. 0027 % 0028 % "ppm2fli" is available at http://vento.pi.tu-berlin.du/ppm2fli/main.html 0029 % 0030 % Two free, popular programs that will convert PCX to PPM are: 0031 % 1. "pcxtoppm", part of the NetPBM image freeware toolkit, available at: 0032 % ftp://ftp.wustl.edu/graphics/graphics/packages/NetPBM/ 0033 % OR 0034 % 2. "convert", part of the ImageMagick image package available at: 0035 % http://www.wizards.dupont.com/cristy/ImageMagick.html 0036 % Some binaries are available for popular platforms -- you might 0037 % want to check this first. 0038 0039 % Rich Signell (rsignell@usgs.gov) adapted from code by Jamie Pringle 0040 0041 global makemovienx makemovieny anim_name 0042 0043 %--------------------------------------------------------------------- 0044 % CHOOSE ONE OF THE FOLLOWING OR ADD YOUR OWN, DEPENDING ON WHAT 0045 % PCX to PPM CONVERSION PROGRAM YOU HAVE: 0046 0047 %convert_command='pcxtoppm' 0048 convert_command='convert pcx:- ppm:-' 0049 %--------------------------------------------------------------------- 0050 % Make the frame list 0051 0052 eval(sprintf('!/bin/ls /tmp/%s???.pcx >! /tmp/%s.lst',anim_name,anim_name)) 0053 0054 % call PPM2FLI (Unix Program) 0055 % using the -N option to allow reverse playback in Xanim 0056 0057 eval(sprintf(... 0058 ['!ppm2fli -f ''' convert_command ''' -N -g %3.0fx%3.0f /tmp/%s.lst %s.flc'],... 0059 makemovienx,makemovieny,anim_name,anim_name)) 0060 0061 disp(sprintf('Created %s.flc',anim_name)); 0062 0063 % remove the temporary files 0064 0065 eval(sprintf('!/bin/rm /tmp/%s???.pcx /tmp/%s.lst',anim_name,anim_name)) 0066 disp(sprintf('Removed temporary images /tmp/%s???.pcx',anim_name))