
%DIGITIZER   Script demonstrating image digitization corrections.
%   Performs the corrections described in problem set 0, problem 1.

% 6.801 Problem Set 0: Problem 1
% Erik Sudderth


% Load and display the original image
original = imread('original.tif');
figure; imshow(original);
title('Original');

% Load and display white field calibration image
whitefield = imread('whiteField.tif');
figure; imshow(whitefield);
title('Whitefield Calibration');

% Cancel multiplicative effects using white field image
multcorrect = im2double(original) ./ im2double(whitefield);

% Plot corrected image, automatically scaling to use full dynamic range
figure; imshow(multcorrect, []);
title('Multiplicative Correction');

% Account for nonlinear monitor display response
nonlinfac = 0.4;   % Try setting this to different values
nonlincorrect = multcorrect .^ nonlinfac;

% Plot final image, again scaling to use full dynamic range
figure; imshow(nonlincorrect, []);
title('Nonlinear Response');

