function A_average = faces_average ( A )

%*****************************************************************************80
%
%% FACES_AVERAGE averages a set of images.
%
%  Licensing:
%
%    This code is distributed under the GNU LGPL license.
%
%  Modified:
%
%    23 December 2018
%
%  Author:
%
%    John Burkardt
%
%  Parameters:
%
%    Input, uint8 A(M,N,K), an array of K grayscale images, each MxN in size.
%
%    Output, uint8 A(M,N), a single MxN grayscale average image.
%

%
%  Make a numerical copy of the image array so we can apply the mean operator.
%
  A_double = double ( A );
%
%  Average the numerical version of the images.
%
  A_double_average = mean ( A_double, 3 );
%
%  Convert the numerical average back to an image.
%
  A_average = uint8 ( A_double_average );

  return
end