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