register_image

sofia_redux.toolkit.image.adjust.register_image(image, reference, upsample=1, maxshift=None, shift0=None)[source]

Return the pixel offset between an image and a reference

Uses cross-correlation (phase correlation) to find the pixel shift between an image and a reference image. If upsample is greater than one, accuracy is increased to a subpixel level by upsampling a DFT in the neighborhood of the integer pixel solution.

Parameters:
imagenumpy.ndarray

Image to register (nrow, ncol). Must be the same shape as reference.

referencenumpy.ndarray

Reference image (nrow, ncol). Must be the same shape as image.

upsampleint, optional

Images will be registered to within 1 / upsample. For example, upsample = 100 results in registration to within 1/100th of a pixel.

maxshiftint or float or array_like, optional

The maximum shift allowed in each dimension. There may be more than one solution when images contain repeating patterns. Therefore, set maxshift to search for maximum correlation within init - maxshift to init + maxshift. An array maxshift should have the same length as the image features whereas a single valued maxshift will be applied to all features. None results in a search over the full image domain. Order of features is (x, y, z, etc.)

shift0array_like

An initial registration estimate in each dimension. This is useful when repeating patterns are present in the image and you wish to center the search at a specific location. Best used in conjunction with maxshift. None centers the search around the center of the reference image. Order of features is (x, y, z, etc.)

Returns:
numpy.array

Pixel registration in the (x, y, z, etc.) order. This is the pixel shift of reference relative to image i.e. apply this shift to image to map it onto reference.