%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%  A program to try to estimate the value of gamma for the 
%  monitor (HP A4331A) with Brightness = 30 and Contrast = 100
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% Creating a test matrix with alternating gray-level values of zero and 254 
m = [0 254;254 0];

Alt_Mat = repmat(m,128,128);
figure;
imshow(Alt_Mat,[0,254]);
title('Alternating gray levels 0 and 254');

% Creating a matrix of constant gray-level value to match the
% brightness of the first matrix

Const  = zeros(256) + 197;
figure;
imshow(Const,[0,254]);
title('Constant Brightness Level = 197');

% The value of the constant matrix was chosen after several
% measurments with the chromometer  

% The value for gamma can be calculated from the formula : 
% Intensity = Frame_Buffer_Value^gamma by equating the two
% equations for the two different values of intensity level 
% and solving for gamma: 0.5*(254)^gamma = (197)^gamma.
% After taking the logarithm (base-10) of both sides, the value
% of gamma obtained was gamma = 2.7 




