============================================================== MAKE_SYNTHETIC_OBJECT: Genrates examples of 1-D images using blending 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 ==============================================================
0001 function [imagelist, images, points] = make_synthetic_object(n_images, returned_image_width, blend1, blend2, blend3) 0002 % ============================================================== 0003 % MAKE_SYNTHETIC_OBJECT: Genrates examples of 1-D images using blending 0004 % functions 0005 % 0006 % Modification of code written by Katherine Smith, 2003 0007 % 0008 % GENERAL 0009 % 0010 % [imagelist,images,points, his, los] = 0011 % make_1d_images(n_images, image_width, white_width) 0012 % 0013 % INPUT/S 0014 % 0015 % -n_images: 0016 % The number of images to generate. 0017 % 0018 % -returned_image_width: 0019 % The width of the 1-D images to be created. Multiple of 6 at present. 0020 % 0021 % -blend1: 0022 % The first blending component. 0023 % 0024 % -blend2: 0025 % The second blending component. 0026 % 0027 % -blend3: 0028 % The third blending component. 0029 % 0030 % 0031 % 0032 % OUTPUT/S 0033 % 0034 % -imagelist: 0035 % The list of the images generated. 0036 % 0037 % -images: 0038 % The images generated. 0039 % 0040 % -points: 0041 % The (control) points of the images generted. 0042 % 0043 % PENDING WORK 0044 % 0045 % - 0046 % 0047 % KNOWN BUG/S 0048 % 0049 % - 0050 % 0051 % COMMENT/S 0052 % 0053 % -The use of this function was aborted rather early. 0054 % 0055 % 0056 % RELATED FUNCTION/S 0057 % 0058 % 0059 % 0060 % ABOUT 0061 % 0062 % -Created: December 20th, 2003 0063 % -Last update: December 20th, 2003 0064 % -Revision: 0.0.1 0065 % -Author: R. S. Schestowitz, University of Manchester 0066 % ============================================================== 0067 0068 image_width = returned_image_width / 4; 0069 unwarped_points = (1:image_width)'; 0070 % set original unwarped points to be diagonal 1..50 0071 % unwarped points is then a column vector [1;2;3...] 0072 % size of <unwarped_points> is 50,1 0073 images = zeros([image_width n_images]); 0074 % set a bunch of black images of appropriate 0075 % size (rather a flat horizontal line at y=0) 0076 points = unwarped_points(:,ones(n_images,1)); 0077 % set points to be a copy of 0078 % unwarped points but of width ten 0079 for i=1:n_images 0080 % for all images 0081 % image = zeros(image_width,1); 0082 blend1 = blend1 + (rand) * 0.2; 0083 blend2 = blend2 + blend1 + (rand) * 0.2; 0084 blend3 = blend3 + blend2 + (rand) * 0.2; 0085 % get some bright shade of white (gray) 0086 % range will be .75 to 0.85 0087 % white = 0.9; 0088 % this_white_width = rand*(image_width/5) + white_width*image_width; 0089 % get random up to 20% of image width and add to 50 times 0090 % white_width which is input often assigned to 0.2 0091 % so values of this_white_width lie between 10 and 30 0092 for j=1:(image_width/3), 0093 images(j,i) = j*j * blend1 + (image_width/2-j) * blend2; 0094 end 0095 for j=(image_width/3+1):(image_width*2/3), 0096 images(j,i) = (j*j * blend2) + (image_width/2-j) * blend3; 0097 end 0098 for j=(image_width*2/3+1):image_width, 0099 images(j,i) = (j*j * blend3) + (image_width/2-j) * blend1; 0100 end 0101 for j=1:image_width 0102 images(j+image_width,i)=images(image_width-j+1,i); 0103 images(j+image_width*3,i)=images(image_width-j+1,i); 0104 images(j+image_width*2,i)=images(j,i); 0105 end 0106 % images(:,i) = average_smooth(images(:,i), 9); 0107 % images(:,i) = average_smooth(images(:,i), 9); 0108 end 0109 0110 0111 0112 filename = ['1dim' num2str(i) '.png']; 0113 % set name of file 0114 % imwrite(images(i,:), filename, 'png'); 0115 % write file 0116 imagelist{i} = filename; 0117 % save in list of images 0118 %figure, plot(image);