MAKE_1D_MODEL: Genrates examples of 2-D images. GENERAL [imagelist, images, points] = make_1d_images(n_images, image_width, image_height) INPUT/S -n_images: The number of images to generate. -image_width: The width of the 2-D images to be created. -image_height: The width of the 2-D images to be created. -position: The position of the structure -width: The width of the structure -height: The height of the structure -width_variation: The variation in width of the structure -height_variation: The variation in height of the structure 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: January 5th, 2003 -Last update: January 5th, 2003 -Revision: 0.0.1 -Author: R. S. Schestowitz, University of Manchester ==============================================================
0001 function [imagelist, images, points] = make_1d_bump(n_images, image_width, image_height, position, width, height, width_variation, height_variation) 0002 % MAKE_1D_MODEL: Genrates examples of 2-D images. 0003 % 0004 % GENERAL 0005 % 0006 % [imagelist, images, points] = make_1d_images(n_images, image_width, image_height) 0007 % 0008 % INPUT/S 0009 % 0010 % -n_images: 0011 % The number of images to generate. 0012 % 0013 % -image_width: 0014 % The width of the 2-D images to be created. 0015 % 0016 % -image_height: 0017 % The width of the 2-D images to be created. 0018 % 0019 % -position: 0020 % The position of the structure 0021 % 0022 % -width: 0023 % The width of the structure 0024 % 0025 % -height: 0026 % The height of the structure 0027 % 0028 % -width_variation: 0029 % The variation in width of the structure 0030 % 0031 % -height_variation: 0032 % The variation in height of the structure 0033 % 0034 % 0035 % OUTPUT/S 0036 % 0037 % -imagelist: 0038 % The list of the images generated. 0039 % 0040 % -images: 0041 % The images generated. 0042 % 0043 % -points: 0044 % The (control) points of the images genearted. 0045 % 0046 % PENDING WORK 0047 % 0048 % 0049 % KNOWN BUG/S 0050 % 0051 % - 0052 % 0053 % COMMENT/S 0054 % 0055 % 0056 % RELATED FUNCTION/S 0057 % 0058 % MAKE_1D_IMAGES, MAKE_1D_BUMP 0059 % 0060 % ABOUT 0061 % 0062 % -Created: January 5th, 2003 0063 % -Last update: January 5th, 2003 0064 % -Revision: 0.0.1 0065 % -Author: R. S. Schestowitz, University of Manchester 0066 % ============================================================== 0067 0068 0069 bump_width = width; 0070 bump_width_variation = width_variation; 0071 0072 bump_height = height; 0073 bump_height_variation = height_variation; 0074 0075 bump_position_freedom = position; 0076 0077 initial_diminish_factor = 2; 0078 diminish_factor = 1.05 + (0.1 * rand * bump_width); 0079 % initialialise the parameters intenrnally for fine-tuning capabilities 0080 0081 %%%%%%%%%% CHANGE BELOW CONTROL POINTS %%%%%%%%%%%%% 0082 0083 unwarped_points = (1:image_width)'; 0084 % get original unwarped points from the input -- diagonal line 0085 0086 images = zeros([image_height image_width n_images]); 0087 % set a bunch of black images of appropriate size, 0088 % the equivalent of making flat asymptotic curves 0089 0090 points = unwarped_points(:,ones(n_images,1)); 0091 % duplicate points to fit number of images 0092 0093 for i=1:n_images, 0094 % for all images 0095 0096 width_x = bump_width + rand * bump_width_variation; 0097 width_y = bump_width + rand * bump_width_variation; 0098 height = bump_height + bump_height_variation * rand; 0099 position_x = bump_position_freedom * rand; 0100 position_y = (bump_position_freedom - width_y) * rand; 0101 % set attributes of the bump using some randomisation 0102 increment = height / initial_diminish_factor; 0103 current_height = height; 0104 % set the current height 0105 for k = 1:image_height, 0106 if (k < (image_height/2)) 0107 current_height = height * (k / image_height); 0108 else 0109 current_height = height * ((image_height - k) / image_height); 0110 end 0111 current_width = width_x; 0112 % if (k < (image_height/2)) 0113 % current_width = width_x * (k / image_height) 0114 % else 0115 % current_width = width_x * ((image_height - k) / image_height) 0116 % end 0117 increment = current_height / initial_diminish_factor; 0118 for j = floor(position_x * image_width):1:floor((position_x + (current_width / 2)) * image_width), 0119 images(k, j, i) = images(k, j-1, i) + increment; 0120 % images(j+1,i) = images(j-1,i) + increment; 0121 increment = increment / diminish_factor; 0122 % images(floor((position+width)*image_width)-j,i) = images(j,i); 0123 end 0124 0125 count=1; 0126 for j = floor(position_x * image_width):1:floor((position_x + (current_width / 2)) * image_width), 0127 images(k,floor((position_x + current_width) * image_width) - count,i) = images(k,j,i); 0128 count = count + 1; 0129 end 0130 end 0131 0132 % images(:,i) = normalise_to_bounds(images(:,i),0,height); 0133 0134 filename = ['1dim' num2str(i) '.png']; 0135 % set name of file 0136 % imwrite(images(i,:), filename, 'png'); 0137 % write file 0138 imagelist{i} = filename; 0139 % save in list of images 0140 % figure, plot(image); 0141 end