ImageFile.align

ImageFile.align(ref, method='scharr', **kargs)

Use one of a variety of algroithms to align two images.

Parameters
  • im (ndarray)

  • ref (ndarray)

Keyword Arguments
  • method (str or None) – If given specifies which module to try and use. Options: ‘scharr’, ‘chi2_shift’, ‘imreg_dft’, ‘cv2’

  • _box (integer, float, tuple of images or floats) – Used with ImageArray.crop to select a subset of the image to use for the aligning process.

  • scale (int) – Rescale the image and reference image by constant factor before finding the translation vector.

  • prefilter (callable) – A method to apply to the image before carrying out the translation to the align to the reference.

  • **kargs (various) – All other keyword arguments are passed to the specific algorithm.

Returns

(ImageArray or ndarray) aligned image

Notes

Currently three algorithms are supported:
  • image_registration module’s chi^2 shift: This uses a dft with an automatic up-sampling of the fourier transform for sub-pixel alignment. The metadata key chi2_shift contains the translation vector and errors.

  • imreg_dft module’s similarity function. This implements a full scale, rotation, translation algorithm (by default cosntrained for just translation). It’s unclear how much sub-pixel translation is accomodated.

  • cv2 module based affine transform on a gray scale image. from: http://www.learnopencv.com/image-alignment-ecc-in-opencv-c-python/