MEDIAN: Compute Median of Several Images

MEDIAN loads the 'dest' buffer with the median of images im1, im2, im3, ... Each pixel in the destination image is the median of the corresponding pixels in the input images. Normally, the program scales each image to have the same mean before computing the median of the stack. If you wish to do the background determination and scaling yourself, you can suppress the auto-rescaling by using the NOMEAN keyword.

Note that all input images must be in VISTA buffers. This prevents computing the median of very large numbers of images because of insufficient memory. For this purpose, try the command BIGMEDIAN, which will median input disk FITS files and store the median in a VISTA buffer.

At least 3 input images must be given. None of the images can be in the same buffer as the output image. All the images must have the same size and starting pixel.

The program is useful for removing cosmic-ray hits from many exposures of the same object. Make sure the location of the objects on the image (stars, location of spectrum, etc) are the SAME on ALL images! Use SHIFT or ALIGN to align images before using MEDIAN.