%prob.2
%read image
img = imread('andie.tif');
imshow(img);
pause;
%show histogram
imhist(img);
pause;
%equalize histogram
imgEQ = histeq(img);
imshow(imgEQ);
pause;
%show histogram
imhist(imgEQ);
pause;
%generate target histogram
for i = 1:127    histo(i) = (i);
end
for i = 128:256    
histo(i) = (257-i);
end
%equalize histogram
imgCustEQ = histeq(img,histo);
imshow(imgCustEQ);
pause;
%show histogram
imhist(imgCustEQ);
pause;
%gamma adjustment 
imgG = imadjust (img,[.2 1],[0 1],2);
imshow(imgG);
pause;
%show histogram
imhist(imgG);
pause;

