CrossCorrelationRegister#

class astropop.image.register.CrossCorrelationRegister(**kwargs)#

Bases: _BaseRegister

Register images using phase_cross_correlation.

It uses cross-correlation to find a translation-only transform between two images. It obtains an initial estimate of the cross-correlation peak by an FFT and then refines the shift estimation by upsampling the DFT only in a small neighborhood of that estimate by means of a matrix-multiply DFT[R4987688c4841-1]_.

Parameters:
upsample_factorint, optional

Upsampling factor. Images will be registered to within 1 / upsample_factor of a pixel. For example upsample_factor == 20 means the images will be registered within 1/20th of a pixel. Default is 1 (no upsampling). Not used if any of reference_mask or moving_mask is not None.

spacestring, one of “real” or “fourier”, optional

Defines how the algorithm interprets input data. “real” means data will be FFT’d to compute the correlation, while “fourier” data will bypass FFT of input data. Case insensitive. Not used if any of reference_mask or moving_mask is not None.

disambiguatebool

The shift returned by this function is only accurate modulo the image shape, due to the periodic nature of the Fourier transform. If this parameter is set to True, the real space cross-correlation is computed for each possible shift, and the shift with the highest cross-correlation within the overlapping area is returned.

return_errorbool, {“always”}, optional

Returns error and phase difference if “always” is given. If False, or either reference_mask or moving_mask are given, only the shift is returned.

overlap_ratiofloat, optional

Minimum allowed overlap ratio between images. The correlation for translations corresponding with an overlap ratio lower than this threshold will be ignored. A lower overlap_ratio leads to smaller maximum translation, while a higher overlap_ratio leads to greater robustness against spurious matches due to small overlap between masked images. Used only if one of reference_mask or moving_mask is not None.

Notes

  • Due to a bug in the phase_cross_correlation normalization is automatically disabled.

  • return_error is set to 'always' to avoid keep compatibility.

References