[daip] request for image cross-correlation routine in AIPS

Claire Chandler cchandle at nrao.edu
Wed Feb 13 11:15:18 EST 2008


Hi Eric, et al.,

I would like to see a routine in AIPS for cross-correlating two images, in 
order to determine the best possible alignment between them.  The output 
of such a routine would be the offset, in pixels and physical units, 
between nominal reference positions in the two images (derived from a fit 
to the peak in the cross-correlation image) along with the 
cross-correlation image.  Note that a cross-correlation of two functions 
g(x) and h(x) is just:

    f(x) = integral [ g(u) h(u+x)du ]

compared with a convolution, which is

    f(x) = integral [ g(u) h(x-u)du ]

and so far so we have been doing this in AIPS via a combination of 
rotations and convolutions.  However, it is fiddly and a proper routine 
for it would be much better (and, I assume, fairly widely used, since I've 
sent my instructions for how to do this to a number of users over the 
years).

This is how we've been doing it in AIPS to date.  It needs the images to 
have the same pixel scales, I'm not sure if it would work on images of 
different sizes, I haven't tested it.

1) if there are any blanked pixels they must be set to zero using REMAG 
(CONVL didn't used to work otherwise, although maybe now it can cope with 
blanks).

2) edit the headers of both images to be cross-correlated so that the 
reference pixel is in the centre of the image (e.g., set to 4096.5,4096.5 
for a 8192 square image).

3) use OGEOM to rotate one of the images by 180 degrees -- note that OGEOM
rotates images about the reference pixel, and if this is not at the centre
of the image I think it introduces blanked pixels at the edges.

4) use CONVL to convolve a normal image with the rotated one, to produce the
cross-correlation.

The location of the peak in this cross-correlation image is where you should
set the reference pixel in the image you rotated for the best alignment of
the two images.

Claire




More information about the Daip mailing list