idlastro / FITS I/O: CORRMAT_ANALYZE

[Source code]

NAME
CORRMAT_ANALYZE 
PURPOSE
Find the optimal (x,y) offset to maximize correlation of 2 images
EXPLANATION
Analyzes the 2-D cross-correlation function of two images
and finds the optimal(x,y) pixel offsets.
Intended for use with function CORREL_IMAGES.
CALLING SEQUENCE
corrmat_analyze, correl_mat, xoffset_optimum, yoffset_optimum, 
        max_corr, edge, plateau, [XOFF_INIT=, YOFF_INIT=, REDUCTION=, 
        MAGNIFICATION=, PLATEAU_THRESH=, /PRINT]
INPUTS
correl_mat = the cross-correlation matrix of 2 images.
                (as computed by function CORREL_IMAGES( imA, imB ) ).
NOTE
If correl_mat(*,*,1) is the number of pixels for each correlation,
(the case when /NUMPIX was specified in call to CORREL_IMAGES)
then sqrt( sqrt( # pixels )) is used as correlation weighting factor.
OPTIONAL INPUT KEYWORDS
XOFF_INIT = initial X pixel offset of image_B relative to image_A.
YOFF_INIT = Y pixel offset, (both as specified to correl_images).
REDUCTION = reduction factor used in call to CORREL_IMAGES.
MAGNIFICATION = magnification factor used in call to CORREL_IMAGES,
        this allows determination of offsets up to fractions of a pixel.
PLATEAU_THRESH = threshold used for detecting plateaus in 
        the cross-correlation matrix near maximum, (default=0.01),
        used only if MAGNIFICATION > 1
/PRINT causes the result of analysis to be printed.
OUTPUTS
xoffset_optimum = optimal X pixel offset of image_B relative to image_A.
yoffset_optimum = optimal Y pixel offset.
max_corr = the maximal correlation corresponding to optimal offset.
edge = 1 if maximum is at edge of correlation domain, otherwise=0.
plateau = 1 if maximum is in a plateau of correlation function, else=0.
PROCEDURE
Find point of maximum cross-correlation and calc. corresponding offsets.
If MAGNIFICATION > 1:
the  correl_mat is checked for plateau near maximum, and if found,
the center of plateau is taken as point of maximum cross-correlation.
MODIFICATION HISTORY
Written, July-1991, Frank Varosi, STX @ NASA/GSFC
Use ROUND instead of NINT, June 1995 Wayne Landsman HSTX
Remove use of non-standard !DEBUG system variable   W.L. HSTX 
Converted to IDL V5.0   W. Landsman   September 1997