%
% Script file: histface.m
%
I=imread('1.pgm');  Z=round(double(I));
m=112;  n=92;
A=reshape(Z,m,n);   % imshow(Z/255.0)
Y=zeros(256);
for i=1:m*n
  g=1+Z(i);
  Y(g)=Y(g)+1;
end     
subplot(2,2,1)
imshow(A/255.0)     % or imshow(Z/255.0)
X=1:256;
subplot(2,2,2)
bar(X,Y,0.8)
title('Histogram of a 112\times92 Face Image')
M=256;  % 256 bins 
subplot(2,2,3)
hist(1+Z,M)
title('Histogram of a 112\times92 Face Image')
subplot(2,2,4)
plot(X,Y,'b-')
title('Histogram of a 112\times92 Face Image')
