MAKE_1D_BUMP: Genrates examples of 1-D images. GENERAL [imagelist,images,points, his, los] = make_1d_bump(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. OUTPUT/S -imagelist: The list of the images generated. -images: The images generated. -points: The (control) points of the images genearted. PENDING WORK -Get this function to work properly KNOWN BUG/S - COMMENT/S -This function does not deliver parameters such as high and low, but these remain of use only in a very limited way in BUILD_1D_MODEL RELATED FUNCTION/S MAKE_1D_IMAGES, BUILD_1D_MODEL ABOUT -Created: December 23rd, 2003 -Last update: January 29th, 2004 -Revision: 0.3.7 -Author: R. S. Schestowitz, University of Manchester ==============================================================
0001 function [imagelist, images, points] = make_1d_bump(n_images, image_width, bump_width, bump_width_variation, bump_height, bump_height_variation, bump_position_freedom, initial_diminish_factor, smoothness_factor, save_bumps, format) 0002 % MAKE_1D_BUMP: Genrates examples of 1-D images. 0003 % 0004 % GENERAL 0005 % 0006 % [imagelist,images,points, his, los] = 0007 % make_1d_bump(n_images, image_width, white_width) 0008 % 0009 % INPUT/S 0010 % 0011 % -n_images: 0012 % The number of images to generate. 0013 % 0014 % -image_width: 0015 % The width of the 1-D images to be created. 0016 % 0017 % OUTPUT/S 0018 % 0019 % -imagelist: 0020 % The list of the images generated. 0021 % 0022 % -images: 0023 % The images generated. 0024 % 0025 % -points: 0026 % The (control) points of the images genearted. 0027 % 0028 % PENDING WORK 0029 % 0030 % -Get this function to work properly 0031 % 0032 % KNOWN BUG/S 0033 % 0034 % - 0035 % 0036 % COMMENT/S 0037 % 0038 % -This function does not deliver parameters such as 0039 % high and low, but these remain of use only in a 0040 % very limited way in BUILD_1D_MODEL 0041 % 0042 % RELATED FUNCTION/S 0043 % 0044 % MAKE_1D_IMAGES, BUILD_1D_MODEL 0045 % 0046 % ABOUT 0047 % 0048 % -Created: December 23rd, 2003 0049 % -Last update: January 29th, 2004 0050 % -Revision: 0.3.7 0051 % -Author: R. S. Schestowitz, University of Manchester 0052 % ============================================================== 0053 0054 diminish_factor = 1 + smoothness_factor / image_width; % + (0.1 * rand * bump_width); 0055 % initialialise the parameters intenrnally for fine-tuning capabilities 0056 0057 unwarped_points = (1:image_width)'; 0058 % get original unwarped points from the input -- diagonal line 0059 0060 images = zeros([image_width n_images]); 0061 % set a bunch of black images of appropriate size, 0062 % the equivalent of making flat asymptotic curves 0063 0064 points = unwarped_points(:,ones(n_images,1)); 0065 % duplicate points to fit number of images 0066 0067 for i = 1:n_images, 0068 % for all images 0069 0070 width = bump_width + rand * bump_width_variation; 0071 height = bump_height + bump_height_variation * rand; 0072 position = (bump_position_freedom - width) * rand; 0073 % set attributes of the bump using some randomisation 0074 increment = height / initial_diminish_factor; 0075 % set the current height 0076 for j = ceil((position * image_width) + 1):floor((position + (width / 2)) * image_width), 0077 images(j,i) = images(j-1,i) + increment; 0078 % images(j+1,i) = images(j-1,i) + increment; 0079 increment = increment/diminish_factor; 0080 % images(floor((position+width)*image_width)-j,i) = images(j,i); 0081 end 0082 0083 count = 1; 0084 for j = ceil((position * image_width) + 1):floor((position + (width / 2)) * image_width), 0085 images(floor((position + width) * image_width) - count - 1,i) = images(j,i); 0086 count = count + 1; 0087 end 0088 0089 images(:,i) = normalise_to_bounds(images(:,i),0,height); 0090 0091 % for j = floor((position+(width/2)) * image_width)+1:1:floor((position+width) * image_width), 0092 % images(j,i) = images(j-1,i) + increment; 0093 % % images(j+1,i) = images(j-1,i) + increment; 0094 % increment = increment/1.2; 0095 % %images(floor((position+width)*image_width)-j,i) = images(j,i); 0096 % end 0097 0098 0099 0100 % increment=height/2; 0101 % % set the current height 0102 % for j = floor(position*image_width):1:floor((position+(width/2)) * image_width), 0103 % increment = increment/1.2; 0104 % images(floor((position+width)*image_width)-j,i) = images(j,i); 0105 % end 0106 0107 0108 0109 % increment=height/2; 0110 % % reset incremental height 0111 % for j = floor((position+width)*image_width):-1:floor((position+(width/2+1)) * image_width), 0112 % % decrement here, i.e. step backwar 0113 % images(j,i) = images(j-1,i) + increment; 0114 % increment = increment/1.2; 0115 % end 0116 0117 filename = ['data' num2str(i) '.' format]; 0118 % set name of file 0119 if (save_bumps == 1), 0120 imwrite(images(:,i), filename, format); 0121 end 0122 % write file 0123 imagelist{i} = filename; 0124 % save in list of images 0125 % figure, plot(image); 0126 end