============================================================== MAKE_ELLIPTIC_BUMPS: Genrates examples of elliptic 1-D images. GENERAL 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 - KNOWN BUG/S - COMMENT/S - RELATED FUNCTION/S MAKE_1D_IMAGES, MAKE_1D_BUMP ABOUT -Created: April 9th , 2004 -Last update: April 9th , 2004 -Revision: 0.0.7 -Author: R. S. Schestowitz, University of Manchester ==============================================================
0001 function [imagelist, images, points] = make_elliptic_bumps(n_images, image_width, save_bumps, format, base_height, position_freedom, height_variation, width_variation) 0002 % ============================================================== 0003 % MAKE_ELLIPTIC_BUMPS: Genrates examples of elliptic 1-D images. 0004 % 0005 % GENERAL 0006 % 0007 % 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 % - 0031 % 0032 % KNOWN BUG/S 0033 % 0034 % - 0035 % 0036 % COMMENT/S 0037 % 0038 % - 0039 % 0040 % RELATED FUNCTION/S 0041 % 0042 % MAKE_1D_IMAGES, MAKE_1D_BUMP 0043 % 0044 % ABOUT 0045 % 0046 % -Created: April 9th , 2004 0047 % -Last update: April 9th , 2004 0048 % -Revision: 0.0.7 0049 % -Author: R. S. Schestowitz, University of Manchester 0050 % ============================================================== 0051 0052 unwarped_points = (1:image_width)'; 0053 % get original unwarped points from the input -- diagonal line 0054 0055 images_temp = zeros([image_width n_images]); 0056 images = zeros([image_width n_images]); 0057 % set a bunch of black images of appropriate size, 0058 % the equivalent of making flat asymptotic curves 0059 0060 points = unwarped_points(:,ones(n_images,1)); 0061 % duplicate points to fit number of images 0062 0063 e = rand; 0064 % a formulation parameter for the ellipse 0065 0066 for i = 1:n_images, 0067 % for all images 0068 0069 % x0 = rand / 4; 0070 % width = rand / 4; 0071 % % 0-0.25 0072 % e = rand; 0073 % % set the current height 0074 % for j = ceil((x0 * image_width) + 1):floor((x0 + (width / 2)) * image_width), 0075 % images(j,i) = e * sqrt(image_width.^2 - j.^2); 0076 % end 0077 % 0078 0079 x0 = ceil ((rand * position_freedom / 4) * image_width + 2); 0080 0081 width_factor = (rand * width_variation + 3) ; 0082 0083 height = base_height + rand / 2 * height_variation; 0084 0085 width = image_width / width_factor; 0086 0087 for x = - width:1: width, 0088 images_temp(x + width + 1, i) = e * sqrt(width.^2 - x.^2); 0089 end 0090 0091 for j = x0:(width * 2 + 1) + x0, 0092 images(j,i) = images_temp (j - x0 + 1, i); 0093 end 0094 0095 images(:,i) = normalise_to_bounds(images(:,i), 0, height); 0096 0097 % plot(images); 0098 filename = ['data' num2str(i) '.' format]; 0099 % set name of file 0100 if (save_bumps == 1), 0101 imwrite(images(:,i), filename, format); 0102 end 0103 % write file 0104 imagelist{i} = filename; 0105 % save in list of images 0106 end