function output = pad(image, desired_size, default_value)
% output = pad(image, desired_size, default_value)
%
% $Id: pad.m,v 1.2 2002/06/20 14:55:19 tobin Exp $

original_size = size(image);

% if default_value == 0
%  output = sparse(desired_size);
% else
   output = ones(desired_size) * default_value;
% end

a = round(desired_size/2 - original_size/2) + [1,1];
b = a + original_size - [1,1];

output(a(1):b(1),a(2):b(2)) = image;
