| 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)
|
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)
% MAKE_1D_BUMP: Generates examples of customised 1-D images.
%
% ABOUT
%
% -Created: April 9th, 2004
% -Last update: April 9th, 2004
% -Revision: 0.0.7
% -Author: R. S. Schestowitz, University of Manchester
% ==============================================================
diminish_factor = 1 + smoothness_factor / image_width;
% initialialise the parameters intenrnally for fine-tuning capabilities
unwarped_points = (1:image_width)';
% get original unwarped points from the input -- diagonal line
images = zeros([image_width n_images]);
% set a bunch of black images of appropriate size,
% the equivalent of making flat asymptotic curves
points = unwarped_points(:,ones(n_images,1));
% duplicate points to fit number of images
for i = 1:n_images,
% for all images
width = bump_width + rand * bump_width_variation;
height = bump_height + bump_height_variation * rand;
position = (bump_position_freedom - width) * rand;
% set attributes of the bump using some randomisation
increment = height / initial_diminish_factor;
% set the current height
for j = ceil((position * image_width) + 1):floor((position + (width / 2)) * image_width),
images(j,i) = images(j-1,i) + increment;
increment = increment/diminish_factor;
end
count = 1;
for j = ceil((position * image_width) + 1):floor((position + (width / 2)) * image_width),
images(floor((position + width) * image_width) - count - 1,i) = images(j,i);
count = count + 1;
end
images(:,i) = normalise_to_bounds(images(:,i),0,height);
filename = ['data' num2str(i) '.' format];
% set name of file
if (save_bumps == 1),
imwrite(images(:,i), filename, format);
end
% write file
imagelist{i} = filename;
% save in list of images
end
|
|