[Previous]
NAME:
xyoff
PURPOSE:
Calculates the correlation function between two images using a box of
size (bx,by) surrounding a point in the image. By default this point
is the center of the image, (nx/2,ny/2). The routine calculates the
offsets by finding the maximum of the correlation function.
CATEGORY:
Image processing
CALLING SEQUENCE:
s = xyoff(a,b,bx,by, hx,hy,fna,wdow=wdow,mask=mask,/sobel,ccf=ccf,/quiet)
INPUTS:
a 2D reference image.
b 2D image that you want to track with respect to a
bx size of the box in the x-dimension that you wish
to use to generate the cross correlation function
by size of the box in the y-dimension that you wish
to use to generate the cross correlation function.
hx x position in the image that corresponds to the center
of the box. (Optional)
hy y position in the image that corresponds to the center
of the box. (Optional)
fna fourier transform of the 256x256 (Optional)
subtended image from the center of a.
OPTIONAL INPUTS:
wdow=wdow 2-d apodization window. (Optional; default=1)
mask=mask 2-d mask to be applied in fourier space. (Optional;default=1)
/sobel If specified, then SOBEL keyword causes this routine
to track on the gradient of the image instead of the
image itself. (It uses a Sobel edge enhancement operator)
/quiet if set, suppress printing of results on screen
OUTPUTS:
s = A vector containing the x and y offsets that should be applied
to an image to maximize the cross correlation.
s[0] = The x offset.
s[1] = The y offset.
s[2] = max value of the correlation
s[3] = cross correlation at 0 shift
s[4] = maximum of the real part of absolute value of cross correlation
INCLUDE:
@compile_opt.pro ; On error, return to caller
CALLS: ***
InitVar, MEAN, max_pos
PROCEDURE:
The executing program is xyoff.pro. It performs a 2D
cross-correlation, yielding the lag of maximum correlation, the
coefficient of maximum correlation and the coefficient at lag 0. In
practice, I usually used lag 0. Within the limits of floating point
computation, the cross correlation at 0 shift of an image and itself is
1.0 and the shifts are 0.0 and 0.0 as would be expected. xyoff.pro
calls max_pos.pro to find the maximum position within an array...the
cross-correlation function in this case.
MODIFICATION HISTORY:
H. Cohl, 7 Jun, 1991 --- Initial programming.
H. Cohl, 13 Dec, 1991 --- Added SOBEL keyword.
H. Cohl, 13 Feb, 1992 --- Made it so that you can enter in hx or hy.
H. Cohl, 25 Mar, 1992 --- Made documentation more understandable.
T. Henry December, 1993 --- some changes made to size