DIPlib Documentation - ©1995-2014 Quantitative Imaging Group, Delft University of Technology.

FindShift

Estimate the shift between images

SYNOPSIS

#include "dip_findshift.h"

dip_Error dip_FindShift ( in1, in2, out, method, parameter )

DATA TYPES

binary, integer, float, complex

FUNCTION

This function estimates the (sub-pixel) global shift between in1 and in2. The numbers found represent the shift of in1 with respect to in2, or the position of the first pixel of in2 in the coordinate system of in1. There are two methods that can be used: CPF and MTS. Both methods require that the shift be small. Therefore, first the integer pixel is calculated, and both images are cropped to the common part.

If method is 0, DIP_FSM_MTS is used.

If method is DIP_FSM_INTEGER_ONLY, integer shifts are calculated using cross correlation. This works for images of any dimensionality.

CPF

The CPF method (marked as FFTS in the literature below) uses the phase of the cross-correlation (as calculated by CrossCorrelationFT) to estimate the shift. parameter sets the amount of frequencies used in this estimation. The maximum value that makes sense is sqrt(1/2). Any larger value will give the same result. Choose smaller values to ignore the higher frequencies, which have a smaller SNR and are more affected by aliasing. If parameter is set to 0, the optimal found for images sub-sampled by a factor four will be used (parameter = 0.2).

This method only supports 2-D images.

MTS

The MTS method (marked as GRS in the literature below) uses a first order Taylor approximation of the equation in1(t) = in2(t-s) at scale parameter. Setting parameter to zero, a scale of 1 will be used. This means that the images will be smoothed with a Gaussian kernel of 1. This method is more accurate than CPF.

This method supports images with a dimensionality between 1 and 3.

ITER

The ITER method is an iterative version of the MTS method. It is known that a single estimation with MTS has a bias due to truncation of the Taylor expansion series (Pham et al., 2005) The bias can be expressed as a polynomial of the subpixel displacements. As a result, if the MTS method is applied iteratively, and the shift is refined after each iteration, the bias eventually becomes negligible. By using just 3 iterations, and noticing that log(bias_increment) is a linear sequence, it is possible to correct for the bias up to O(1e-6).

Set parameter to 0 for normal behaviour. Other bahaviour is not supported, but: a parameter in the range (0,0.1] speficies the desired accuracy; parameter<0 causes round(-parameter) iterations to be run.

This method supports images with a dimensionality between 1 and 3.

PROJ

The PROJ method computes the shift in each dimension separately, applying the ITER method on the various projections of the image onto a single axis. It is fast and fairly accurate for high SNR. Should not be used for low SNR.

This method supports images with any number of dimensions.

ARGUMENTS

Data typeNameDescription
dip_Imagein1Input image
dip_Imagein2Input image
dip_FloatArrayoutEstimated shift
dipf_FindShiftMethodmethodEstimation method
dip_floatparameterParameter

The dipf_FindShiftMethod enumeration consists of the following flags:

NameDescription
DIP_FSM_DEFAULTDefault method (MTS)
DIP_FSM_INTEGER_ONLYFind only integer shift
DIP_FSM_CPFCross-correlation method
DIP_FSM_FFTSSame
DIP_FSM_MTSTaylor series method
DIP_FSM_GRSSame
DIP_FSM_ITERIterative version of MTS
DIP_FSM_PROJOne-dimensional projectoin method
DIP_FSM_NCCUndocumented

LITERATURE

C.L. Luengo Hendriks, Improved Resolution in Infrared Imaging Using Randomly Shifted Images, M.Sc. Thesis, Delft University of Technology, 1998

T.Q. Pham, M. Bezuijen, L.J. van Vliet, K. Schutte, C.L. Luengo Hendriks, Performance of Optimal Registration Estimators, In Proc. of SPIE 5817 - Visual Information Processing XIV, Defense and Security Symposium, Orlando, 2005

SEE ALSO

CrossCorrelationFT