%
% GrayPatchFun.m
%
% Generate gray patch image with monitor Gamma inverse to test camera gamma
%
% Hui Li
% 3/7/2000
%	

function [gp, outfile] = GrayPatchFun(gamma)

c1 = zeros(192,256)+2;
c2 = zeros(192,256)+32;
c3 = zeros(192,256)+64;
c4 = zeros(192,256)+96;
c5 = zeros(192,256)+128;
c6 = zeros(192,256)+160;
c7 = zeros(192,256)+192;
c8 = zeros(192,256)+224;
c9 = zeros(192,256)+255;

im = [c1 c2 c3; c4 c5 c6; c7 c8 c9];

im = double(im)./255;

figure
imshow(im);

% Monitor Gamma correction inverse
gp = im.^(1/gamma);

figure
imshow(gp);

imwrite(gp, 'GrayPatch.jpg', 'jpg');



	
