function [imagelist, images, points] = make_synthetic_object(n_images, returned_image_width, blend1, blend2, blend3)
% ==============================================================
% functions
%
% Modification of code written by Katherine Smith, 2003
%
%    GENERAL
%
%      [imagelist,images,points, his, los] = 
%         make_1d_images(n_images, image_width, white_width)
%
%    INPUT/S
%
%      -n_images:
%           The number of images to generate.
%
%      -returned_image_width:
%           The width of the 1-D images to be created. Multiple of 6 at present.
%
%      -blend1:
%           The first blending component.
%
%      -blend2:
%           The second blending component.
%
%      -blend3:
%           The third blending component.
%
%
%           
%    OUTPUT/S
%
%      -imagelist:
%           The list of the images generated.
%
%      -images:
%           The images generated.
%
%      -points:
%           The (control) points of the images generted.
%
%    PENDING WORK
%
%      -
%
%    KNOWN BUG/S
%
%      -
%
%    COMMENT/S
%
%      -The use of this function was aborted rather early.
%
%
%    RELATED FUNCTION/S
%
%      
%
%    ABOUT
%
%      -Created:     December 20th, 2003
%      -Last update: December 20th, 2003
%      -Revision:    0.0.1
%      -Author:      R. S. Schestowitz, University of Manchester
% ==============================================================

image_width = returned_image_width / 4;
unwarped_points = (1:image_width)'; 
          % set original unwarped points to be diagonal 1..50
          % unwarped points is then a column vector [1;2;3...]
          % size of <unwarped_points> is 50,1
images = zeros([image_width n_images]); 
          % set a bunch of black images of appropriate
          % size (rather a flat horizontal line at y=0)
points = unwarped_points(:,ones(n_images,1));
          % set points to be a copy of 
          % unwarped points but of width ten
for i=1:n_images 
          % for all images
   %  image = zeros(image_width,1);
  blend1 = blend1 + (rand) * 0.2;
  blend2 = blend2 + blend1 + (rand) * 0.2;
  blend3 = blend3 + blend2 + (rand) * 0.2;
          % get some bright shade of white (gray)
          % range will be .75 to 0.85
          %  white = 0.9;
          % this_white_width = rand*(image_width/5) + white_width*image_width; 
          % get random up to 20% of image width and add to 50 times
          % white_width which is input often assigned to 0.2
          % so values of this_white_width lie between 10 and 30
    for j=1:(image_width/3),
      images(j,i) = j*j * blend1 + (image_width/2-j) * blend2;
    end
    for j=(image_width/3+1):(image_width*2/3),
      images(j,i) = (j*j * blend2) + (image_width/2-j) * blend3;
    end
    for j=(image_width*2/3+1):image_width,
      images(j,i) = (j*j * blend3) + (image_width/2-j) * blend1;
    end
    for j=1:image_width 
      images(j+image_width,i)=images(image_width-j+1,i);
      images(j+image_width*3,i)=images(image_width-j+1,i);
      images(j+image_width*2,i)=images(j,i);
    end  
    % images(:,i) = average_smooth(images(:,i), 9);
    % images(:,i) = average_smooth(images(:,i), 9);
end



filename = ['1dim' num2str(i) '.png']; 
          % set name of file
%  imwrite(images(i,:), filename, 'png'); 
          % write file
imagelist{i} = filename;
          % save in list of images
%figure, plot(image);
