Home > Source > 2D > make_synthetic_object.m

make_synthetic_object

PURPOSE ^

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

SYNOPSIS ^

function [imagelist, images, points] = make_synthetic_object(n_images, returned_image_width, blend1, blend2, blend3)

DESCRIPTION ^

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

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [imagelist, images, points] = make_synthetic_object(n_images, returned_image_width, blend1, blend2, blend3)
0002 % ==============================================================
0003 % functions
0004 %
0005 % Modification of 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 %      -returned_image_width:
0018 %           The width of the 1-D images to be created. Multiple of 6 at present.
0019 %
0020 %      -blend1:
0021 %           The first blending component.
0022 %
0023 %      -blend2:
0024 %           The second blending component.
0025 %
0026 %      -blend3:
0027 %           The third blending component.
0028 %
0029 %
0030 %
0031 %    OUTPUT/S
0032 %
0033 %      -imagelist:
0034 %           The list of the images generated.
0035 %
0036 %      -images:
0037 %           The images generated.
0038 %
0039 %      -points:
0040 %           The (control) points of the images generted.
0041 %
0042 %    PENDING WORK
0043 %
0044 %      -
0045 %
0046 %    KNOWN BUG/S
0047 %
0048 %      -
0049 %
0050 %    COMMENT/S
0051 %
0052 %      -The use of this function was aborted rather early.
0053 %
0054 %
0055 %    RELATED FUNCTION/S
0056 %
0057 %
0058 %
0059 %    ABOUT
0060 %
0061 %      -Created:     December 20th, 2003
0062 %      -Last update: December 20th, 2003
0063 %      -Revision:    0.0.1
0064 %      -Author:      R. S. Schestowitz, University of Manchester
0065 % ==============================================================
0066 
0067 image_width = returned_image_width / 4;
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   blend1 = blend1 + (rand) * 0.2;
0082   blend2 = blend2 + blend1 + (rand) * 0.2;
0083   blend3 = blend3 + blend2 + (rand) * 0.2;
0084           % get some bright shade of white (gray)
0085           % range will be .75 to 0.85
0086           %  white = 0.9;
0087           % this_white_width = rand*(image_width/5) + white_width*image_width;
0088           % get random up to 20% of image width and add to 50 times
0089           % white_width which is input often assigned to 0.2
0090           % so values of this_white_width lie between 10 and 30
0091     for j=1:(image_width/3),
0092       images(j,i) = j*j * blend1 + (image_width/2-j) * blend2;
0093     end
0094     for j=(image_width/3+1):(image_width*2/3),
0095       images(j,i) = (j*j * blend2) + (image_width/2-j) * blend3;
0096     end
0097     for j=(image_width*2/3+1):image_width,
0098       images(j,i) = (j*j * blend3) + (image_width/2-j) * blend1;
0099     end
0100     for j=1:image_width 
0101       images(j+image_width,i)=images(image_width-j+1,i);
0102       images(j+image_width*3,i)=images(image_width-j+1,i);
0103       images(j+image_width*2,i)=images(j,i);
0104     end  
0105     % images(:,i) = average_smooth(images(:,i), 9);
0106     % images(:,i) = average_smooth(images(:,i), 9);
0107 end
0108 
0109 
0110 
0111 filename = ['1dim' num2str(i) '.png']; 
0112           % set name of file
0113 %  imwrite(images(i,:), filename, 'png');
0114           % write file
0115 imagelist{i} = filename;
0116           % save in list of images
0117 %figure, plot(image);

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