dftups

fft_psd_tools.dftups(inp, nor=None, noc=None, usfac=1, roff=0, coff=0)[source] [edit on github]

translated from matlab http://www.mathworks.com/matlabcentral/fileexchange/18401-efficient-subpixel-image-registration-by-cross-correlation/content/html/efficient_subpixel_registration.html

Upsampled DFT by matrix multiplies, can compute an upsampled DFT in just a small region. usfac Upsampling factor (default usfac = 1) [nor,noc] Number of pixels in the output upsampled DFT, in

units of upsampled pixels (default = size(in))
roff, coff Row and column offsets, allow to shift the output array to
a region of interest on the DFT (default = 0)

Recieves DC in upper left corner, image center must be in (1,1) Manuel Guizar - Dec 13, 2007 Modified from dftus, by J.R. Fienup 7/31/06

This code is intended to provide the same result as if the following operations were performed

  • Embed the array “in” in an array that is usfac times larger in each dimension. ifftshift to bring the center of the image to (1,1).
  • Take the FFT of the larger array
  • Extract an [nor, noc] region of the result. Starting with the [roff+1 coff+1] element.

It achieves this result by computing the DFT in the output array without the need to zeropad. Much faster and memory efficient than the zero-padded FFT approach if [nor noc] are much smaller than [nr*usfac nc*usfac]