Home > Source > Simple_1D > make_1d_images.m

# make_1d_images

## PURPOSE

MAKE_1D_MODEL: Genrates examples of 1-D images.

## 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

still not understood.
-Most comments are old and should be ignored (2004)

RELATED FUNCTION/S

-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:
• build_1d_model BUILD_1D_MODEL: Builds a 1-D model and returns some related statistics.

## SOURCE CODE

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

Generated on Fri 14-May-2004 10:05:30 by m2html © 2003