% Invert exposure by a frame transfer CCD.
function result = invert_ft(image, T, f)
% image = image from frame transfer CCD, in counts
% T = exposure time
% f = readout rate, rows per unit time
% result = estimated unsmeared image (incident intensity times T, in counts).

isize = size(image);
Nx = isize(2); % number of columns
Ny = isize(1); % number of rows

result = image;
   
% Now simulate the frame transfer.
for y = Ny-1 : -1 : 1
   result(1:y,:) -= result(y+1,:)/(f*T);  % THIS LINE IS WORTH DISCUSSING!
end

% The result is in counts!

