function out = fftprep(inp,m) % % FFTPREP % % out = fftprep(inp) % embeds input image in the center of a blank square image % whose size is a power of two. % % out = fftprep(inp,m) % embeds input image in the center of a blank square image of size m. % % Author: John S. Loomis 6 March 2000 inp = im2double(inp); s = size(inp); ms = max(s); n2 = 1; while (n2<ms) n2 = n2*2; end if (nargin<2) m = n2; elseif (m<n2) m = n2; end out = zeros(m,m); row_offset = floor((m - s(1)+1)/2); col_offset = floor((m - s(2)+1)/2); out(1+row_offset:s(1)+row_offset,1+col_offset:s(2)+col_offset) = inp;