correlate2d

image_registration.fft_tools.correlate2d(im1, im2, boundary='wrap', nthreads=1, use_numpy_fft=False, **kwargs)[source]

Cross-correlation of two images of arbitrary size. Returns an image cropped to the largest of each dimension of the input images

Parameters:
return_fft - if true, return fft(im1)*fft(im2[::-1,::-1]), which is the power

spectral density

fftshift - if true, return the shifted psd so that the DC component is in

the center of the image

pad - Default on. Zero-pad image to the nearest 2^n
crop - Default on. Return an image of the size of the largest input image.

If the images are asymmetric in opposite directions, will return the largest image in both directions.

boundary: str, optional
A flag indicating how to handle boundaries:
  • ‘fill’set values outside the array boundary to fill_value

    (default)

  • ‘wrap’ : periodic boundary

nthreadsbool

Number of threads to use for fft (only matters if you have fftw installed)

use_numpy_fftbool

Force use numpy’s fft over fftw? (only matters if you have fftw installed)

WARNING: Normalization may be arbitrary if you use the PSD