%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Author: Roland Miezianko (rmiezian@astro.temple.edu)
% Date: Spring 2003
% Instructor: Dr.Longin Jan Latecki
% Course: CIS 750
% Project : Assignment 2
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

function [noOfFrameImages] = GenerateFrames(aviFileName, imageFileNamePrefix)

% create movie object
movieObj = aviread(aviFileName);

% store file information (not used)
% fileinfo = aviinfo(aviFileName);

% store number of frames
noOfFrameImages = size(movieObj,2);

% generate gray level frames
for count = 1 : 1 : noOfFrameImages
   
    % generate the filename
    fileName = strcat( imageFileNamePrefix, num2str(count), '.bmp' );
    
    % store the individual frame in a bmp file
    imwrite( movieObj(count).cdata, fileName, 'bmp' );    
    
    % disp(r) % show the frame we are working with...    
end

return;