% Simulate exposure by a frame transfer CCD.
function result = ft(image, T, f)
% image = image in counts per unit time
% T = exposure time
% f = readout rate, rows per unit time
% result = CCD image in counts

isize = size(image);
Nx = isize(2); % number of columns
Ny = isize(1); % number of rows
% IN OCTAVE/MATLAB, IMAGES ARE INDEXED image(y,x).
% In other words, the indexing is row major (row, column).
% The syntax in these languages is oriented toward matrix 
% algebra; image processing was an afterthought.
% Note that rows are counted from the top down, and columns
% are counted left-to-right.


result = image*T; % Nominally uniform exposure prior to transfer.
   % This isn't quite right, but it's an OK approximation so
   % long as the frame transfer takes << T.
   
% Now simulate the frame transfer.
for y=1:Ny-1
   result(1:y,:) += image(y+1,:)/f;  % THIS LINE IS WORTH DISCUSSING!
end