Home > Source > Simple_1D > make_1d_images.m

make_1d_images

PURPOSE ^

==============================================================

SYNOPSIS ^

function [imagelist,images,points, his, los] = make_1d_images(n_images, image_width, white_width)

DESCRIPTION ^

 ==============================================================
 MAKE_1D_MODEL: Genrates examples of 1-D images.

 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.

      -image_width:
           The width of the 1-D images to be created.

      -white_width:
           The width of the white component??
           
    OUTPUT/S

      -imagelist:
           The list of the images generated.

      -images:
           The images generated.

      -points:
           The (control) points of the images generted.

      -his:
           The upper bound of the examples generated? IT
           APPEARS TO BE NUMBER OF POINTS WHERE BUMP IS HIGH

      -los:
           The lower bound of the examples generated?

    PENDING WORK

      -Understand function better.
      -Improve input/output documentation.

    KNOWN BUG/S

      -

    COMMENT/S

      -Some comments added 28/11/03. The notion of 'white' is
       still not understood.
      -Most comments are old and should be ignored (2004)

    RELATED FUNCTION/S

      

    ABOUT

      -Created:     November 23rd, 2003
      -Last update: Novermber 28th, 2003
      -Revision:    0.0.4
      -Author:      R. S. Schestowitz, University of Manchester
 ==============================================================

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [imagelist,images,points, his, los] = make_1d_images(n_images, image_width, white_width)
0002 % ==============================================================
0003 % MAKE_1D_MODEL: Genrates examples of 1-D images.
0004 %
0005 % Code written by Katherine Smith, 2003
0006 %
0007 %    GENERAL
0008 %
0009 %      [imagelist,images,points, his, los] =
0010 %         make_1d_images(n_images, image_width, white_width)
0011 %
0012 %    INPUT/S
0013 %
0014 %      -n_images:
0015 %           The number of images to generate.
0016 %
0017 %      -image_width:
0018 %           The width of the 1-D images to be created.
0019 %
0020 %      -white_width:
0021 %           The width of the white component??
0022 %
0023 %    OUTPUT/S
0024 %
0025 %      -imagelist:
0026 %           The list of the images generated.
0027 %
0028 %      -images:
0029 %           The images generated.
0030 %
0031 %      -points:
0032 %           The (control) points of the images generted.
0033 %
0034 %      -his:
0035 %           The upper bound of the examples generated? IT
0036 %           APPEARS TO BE NUMBER OF POINTS WHERE BUMP IS HIGH
0037 %
0038 %      -los:
0039 %           The lower bound of the examples generated?
0040 %
0041 %    PENDING WORK
0042 %
0043 %      -Understand function better.
0044 %      -Improve input/output documentation.
0045 %
0046 %    KNOWN BUG/S
0047 %
0048 %      -
0049 %
0050 %    COMMENT/S
0051 %
0052 %      -Some comments added 28/11/03. The notion of 'white' is
0053 %       still not understood.
0054 %      -Most comments are old and should be ignored (2004)
0055 %
0056 %    RELATED FUNCTION/S
0057 %
0058 %
0059 %
0060 %    ABOUT
0061 %
0062 %      -Created:     November 23rd, 2003
0063 %      -Last update: Novermber 28th, 2003
0064 %      -Revision:    0.0.4
0065 %      -Author:      R. S. Schestowitz, University of Manchester
0066 % ==============================================================
0067 
0068 unwarped_points = (1:image_width)'; 
0069           % set original unwarped points to be diagonal 1..50
0070           % unwarped points is then a column vector [1;2;3...]
0071           % size of <unwarped_points> is 50,1
0072 images = zeros([image_width n_images]); 
0073           % set a bunch of black images of appropriate
0074           % size (rather a flat horizontal line at y=0)
0075 points = unwarped_points(:,ones(n_images,1));
0076           % set points to be a copy of
0077           % unwarped points but of width ten
0078       for i=1:n_images 
0079           % for all images
0080 %  image = zeros(image_width,1);
0081   white = 0.75 + (rand-0.5)*0.2; 
0082           % get some bright shade of white (gray)
0083           % range will be .75 to 0.85
0084 %  white = 0.9;
0085   this_white_width = rand*(image_width/5) + white_width*image_width; 
0086           % get random up to 20% of image width and add to 50 times
0087           % white_width which is input often assigned to 0.2
0088           % so values of this_white_width lie between 10 and 30
0089   if(this_white_width > 0) 
0090           % if this white shade/value exists
0091     los(i) = floor((image_width+1)/2-this_white_width/2); 
0092           % set high and low value
0093     his(i) = ceil((image_width+1)/2+this_white_width/2);
0094           % Is this the half bumb which is symmetric??
0095     for j=los(i):his(i) 
0096           % within this range...
0097 %      image(j) = white;
0098       images(j,i) = white;
0099     end
0100   end
0101   filename = ['1dim' num2str(i) '.png']; 
0102           % set name of file
0103 %  imwrite(images(i,:), filename, 'png');
0104           % write file
0105   imagelist{i} = filename;
0106           % save in list of images
0107   %figure, plot(image);
0108   his = his'; 
0109           % returns the highs and lows in correct form
0110   los = los';
0111 end

Generated on Thu 13-May-2004 18:00:46 by m2html © 2003