Home > Source > Data > make_elliptic_bumps.m

make_elliptic_bumps

PURPOSE ^

MAKE_ELLIPTIC_BUMPS: Genrates examples of elliptic 1-D images.

SYNOPSIS ^

function [imagelist, images, points] = make_elliptic_bumps(n_images, image_width, save_bumps, format, base_height, position_freedom, height_variation, width_variation)

DESCRIPTION ^

 MAKE_ELLIPTIC_BUMPS: Genrates examples of elliptic 1-D images.

    GENERAL

      

    INPUT/S

      -n_images:
           The number of images to generate.

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

      -imagelist:
           The list of the images generated.

      -images:
           The images generated.

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

    PENDING WORK

      -

    KNOWN BUG/S

      -

    COMMENT/S

      -

    RELATED FUNCTION/S

      MAKE_1D_IMAGES, MAKE_1D_BUMP

    ABOUT

      -Created:     April 9th , 2004
      -Last update: April 9th , 2004
      -Revision:    0.0.7
      -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] = make_elliptic_bumps(n_images, image_width, save_bumps, format, base_height, position_freedom, height_variation, width_variation)
0002 % MAKE_ELLIPTIC_BUMPS: Genrates examples of elliptic 1-D images.
0003 %
0004 %    GENERAL
0005 %
0006 %
0007 %
0008 %    INPUT/S
0009 %
0010 %      -n_images:
0011 %           The number of images to generate.
0012 %
0013 %      -image_width:
0014 %           The width of the 1-D images to be created.
0015 %
0016 %    OUTPUT/S
0017 %
0018 %      -imagelist:
0019 %           The list of the images generated.
0020 %
0021 %      -images:
0022 %           The images generated.
0023 %
0024 %      -points:
0025 %           The (control) points of the images genearted.
0026 %
0027 %    PENDING WORK
0028 %
0029 %      -
0030 %
0031 %    KNOWN BUG/S
0032 %
0033 %      -
0034 %
0035 %    COMMENT/S
0036 %
0037 %      -
0038 %
0039 %    RELATED FUNCTION/S
0040 %
0041 %      MAKE_1D_IMAGES, MAKE_1D_BUMP
0042 %
0043 %    ABOUT
0044 %
0045 %      -Created:     April 9th , 2004
0046 %      -Last update: April 9th , 2004
0047 %      -Revision:    0.0.7
0048 %      -Author:      R. S. Schestowitz, University of Manchester
0049 % ==============================================================
0050 
0051 unwarped_points = (1:image_width)'; 
0052           % get original unwarped points from the input -- diagonal line
0053           
0054 images_temp = zeros([image_width n_images]);          
0055 images = zeros([image_width n_images]); 
0056           % set a bunch of black images of appropriate size,
0057           % the equivalent of making flat asymptotic curves
0058           
0059 points = unwarped_points(:,ones(n_images,1));
0060           % duplicate points to fit number of images
0061 
0062 e = rand;
0063           % a formulation parameter for the ellipse
0064 
0065 for i = 1:n_images,
0066               % for all images
0067      
0068     %   x0 = rand / 4;
0069     %   width = rand / 4;
0070     %      % 0-0.25
0071     %      e = rand;
0072     %         % set the current height
0073     %   for j = ceil((x0 * image_width) + 1):floor((x0 + (width / 2)) * image_width),
0074     %     images(j,i) = e * sqrt(image_width.^2 - j.^2);
0075     %   end
0076     %
0077 
0078     x0 = ceil ((rand * position_freedom / 4) * image_width + 2);
0079     
0080     width_factor = (rand * width_variation + 3) ;
0081     
0082     height = base_height + rand / 2 * height_variation;
0083     
0084     width = image_width / width_factor;
0085     
0086     for x = - width:1: width,
0087       images_temp(x + width + 1, i) = e * sqrt(width.^2 - x.^2);
0088     end
0089     
0090     for j = x0:(width * 2 + 1) + x0,
0091         images(j,i) = images_temp (j - x0 + 1, i);
0092     end   
0093     
0094     images(:,i) = normalise_to_bounds(images(:,i), 0, height);
0095     
0096 % plot(images);
0097   filename = ['data' num2str(i) '.' format]; 
0098           % set name of file
0099   if (save_bumps == 1),     
0100      imwrite(images(:,i), filename, format);
0101   end   
0102           % write file
0103   imagelist{i} = filename;
0104           % save in list of images
0105 end

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