- Form: CROSS dest source1 source2 [BOX=n] [RAD=r] [RADR=r] [RADC=c] [CORR]
-
- dest
- is the buffer in which the cross-correlation will be stored,
- source1,source2
- are the images to cross-correlate,
- BOX=n
- tells VISTA to use in box 'n',
- RAD=r
- defines the radius of the resulting cross-correlation image
(the image will run from row -r to row +r and from col -r to col +r).
- RADC= RADR=
- To specify two different radii for the cross-
correlation.
- CORR
- Compute instead of the cross-correlation (XC=<AB>),
the correlation coefficient: (R=(XC-<A><B>)/SIG(A)*SIG(B))
CROSS does a cross-correlation on two images, loading the resulting image
into a third buffer. This program is useful for registering two images or
determining a shift between two spectra, for instance. It is usual practice
to subtract an appropriate baseline from the images, usually the sky level
for images and the continuum level for spectra. The RAD=r keyword defines
the half-size of the cross-correlation image. If not specified the
cross-correlation will be the same size as the first source image.
However, a cross-correlation of a two-D image involves four nested DO
loops, so it is advisable to use the RAD= keyword when possible so that two
of the DO loops are short. Often only the peak of the cross-correlation is
of interest, so that the a very small radius may be specified (between 2
and 5, say). Spectra are automatically cross-correlated in one-dimension
only.
The CORR keyword makes the routine compute full correlation coefficients
rather than just cross-correlations as a function of lag. This option
involved about a factor of 3 more operations, so runs slower. It is
important for radial velocities or displacements because the correlation
peak tends to be more symmetric than the cross-correlation
peak. Asymmetries in cross-correlation and in correlation arise because
both are computed over a finite region.
The peak of the cross-correlation image may be found using the SURFACE
command with the LOAD keyword as in the following example, which
cross-correlates two images, calculates the peak of the cross-correlation,
and then shifts the two images into register:
- CROSS 3 1 2 RAD=3
- ABX 3 HIGH_COL=HC HIGH_ROW=HR
- BOX 1 CC=HC CR=HR N=3 (or possibly N=5 or larger if cross correlation
function is well behaved)
- WINDOW 3 BOX=1
- SURFACE 3 LOAD
- DENOM=4*COEFFC2*COEFFR2-COEFFRC*COEFFRC
- DELR=MIDR+(COEFFC*COEFFRC-2*COEFFR*COEFFC2)/DENOM
- DELC=MIDC+(COEFFR*COEFFRC-2*COEFFR2*COEFFC)/DENOM
- SHIFT 2 DR=DELR DC=DELC SINC