function image_threshold_test ( )

%*****************************************************************************80
%
%% image_threshold_test() tests image_threshold().
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    04 February 2019
%
%  Author:
%
%    John Burkardt
%
  addpath ( '../image_threshold' );

  timestamp ( )
  fprintf ( 1, '\n' );
  fprintf ( 1, 'image_threshold_test():\n' );
  fprintf ( 1, '  MATLAB/Octave version %s\n', version ( ) );
  fprintf ( 1, '  Test image_threshold().\n' );

  gray = imread ( 'conjunction_gray.png' );
  a = 50;
  gray_new = image_threshold ( gray, a );
  filename = 'conjunction_bw_050.png';
  imwrite ( gray_new, filename, 'png' );
  fprintf ( 1, '  Graphics saved as "%s"\n', filename );
  figure ( 1 );
  imshow ( gray_new );

  gray = imread ( 'conjunction_gray.png' );
  a = 100;
  gray_new = image_threshold ( gray, a );
  filename = 'conjunction_bw_100.png';
  imwrite ( gray_new, filename, 'png' );
  fprintf ( 1, '  Graphics saved as "%s"\n', filename );
  figure ( 2 );
  imshow ( gray_new );

  gray = imread ( 'star_field_gray.png' );
  a = 50;
  gray_new = image_threshold ( gray, a );
  filename = 'starfield_bw_050.png';
  imwrite ( gray_new, filename, 'png' );
  fprintf ( 1, '  Graphics saved as "%s"\n', filename );
  figure ( 3 );
  imshow ( gray_new );

  gray = imread ( 'star_field_gray.png' );
  a = 100;
  gray_new = image_threshold ( gray, a );
  filename = 'starfield_bw_100.png';
  imwrite ( gray_new, filename, 'png' );
  fprintf ( 1, '  Graphics saved as "%s"\n', filename );
  figure ( 4 );
  imshow ( gray_new );

  gray = imread ( 'star_field_gray.png' );
  a = 150;
  gray_new = image_threshold ( gray, a );
  filename = 'starfield_bw_150.png';
  imwrite ( gray_new, filename, 'png' );
  fprintf ( 1, '  Graphics saved as "%s"\n', filename );
  figure ( 5 );
  imshow ( gray_new );

  gray = imread ( 'star_field_gray.png' );
  a = 200;
  gray_new = image_threshold ( gray, a );
  filename = 'starfield_bw_200.png';
  imwrite ( gray_new, filename, 'png' );
  fprintf ( 1, '  Graphics saved as "%s"\n', filename );
  figure ( 6 );
  imshow ( gray_new );

  gray = imread ( 'star_field_gray.png' );
  a = 250;
  gray_new = image_threshold ( gray, a );
  filename = 'starfield_bw_250.png';
  imwrite ( gray_new, filename, 'png' );
  fprintf ( 1, '  Graphics saved as "%s"\n', filename );
  figure ( 7 );
  imshow ( gray_new );
%
%  Terminate.
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'image_threshold_test():\n' );
  fprintf ( 1, '  Normal end of execution.\n' );
  fprintf ( 1, '\n' );
  timestamp ( )

  rmpath ( '../image_threshold' );

  return
end
function timestamp ( )

%*****************************************************************************80
%
%% timestamp() prints the current YMDHMS date as a timestamp.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    14 February 2003
%
%  Author:
%
%    John Burkardt
%
  t = now;
  c = datevec ( t );
  s = datestr ( c, 0 );
  fprintf ( 1, '%s\n', s );

  return
end


