Combining Images
Combining images was covered briefly in the Image Processing Basics section. Here, more detail is given on methods for combining multiple images to increase detail and to reduce noise.
Methods for Combining Images
The simplest way to combine images is to add them together. This is called summing the images. Summing is, for example, what SBIG's Track & Accumulate function does when combining images. Other possibilities include averaging and median combining, which tend to reduce certain types of noise more than summing can. Programs like Adobe Photoshop offer a variety of other ways to stack images. Also, just about any combination of methods can be employed, although some are more useful than others. The advantages and disadvantages of some of the most common methods are described below.
Summing
The idea behind noise reduction in CCD images is something called signal-to-noise ratio (SNR). The signal in an image is produced by the object being imaged. The noise comes from sources such as light pollution, heat in the camera, and the process of reading the data out of the camera (among others). The ratio of the signal to this noise determines whether an object can be seen in the image. There is some threshold where the signal will be lost in the noise. Good data is considered to have a SNR of at least 3:1.
However, summing two images doubles the signal, but does not double the noise. Why? Signal is constant. A galaxy being imaged will not change from one exposure to the next. Noise, on the other hand, is random, and therefore different from image to image. Summing two images doubles the signal, but the noise increases only by the square root of 2 (about 1.4 times). In fact, adding together any number of images will multiply the signal by that number while only increasing the noise by the square root of that number.
If a star has a signal-to-noise ratio of 2:1, as in the example above, it is not visible in a single exposure. However, by adding, say, 10 exposure together, the star now has a SNR of more than 6:1. This is because the signal increases tenfold, while the noise goes up only by the square root of ten, which is about 3.16. Instead of 2:1 we now have (2 x 3.16):1 or 6.3:1.
The actual calculation of SNR is a bit more complicated than it might at first seem. Basically, the idea is to measure the signal from a star or other interesting region of the image. Then, the noise is measured from the background of the image. The signal is typically measured over a number of pixels (rather than from just one, to minimize errors). This measurement is called the intensity. The intensity is then divided by the square root of the number of pixels used in the measurement. This number is then divided by the background standard deviation (the measure of noise in an image) to determine the SNR.
Fortunately, some CCD software programs do this all for you automatically, such as using the Information Window in MaxIm DL.
Above: The image on the left is of a star with a SNR of about 6:1. On the right is the sum of three images, now producing a SNR of 16:1.
The potential drawback to summing images is that despite the SNR increases, the noise itself increases. Sometimes it is desirable to simply minimize the noise without significantly changing the signal in the image. This is what the next two procedures accomplish.
Averaging and Median Combining
The background standard deviation is a measure of the noise in an image. Programs such as MaxIm DL can be used to measure this standard deviation in an image to determine the amount of noise. Averaging or median combining two images will decrease the background standard deviation in the final image, decreasing the noise and producing a significantly smoother-looking picture.
Above: A single exposure of the Whirlpool Galaxy on the left, and a median combine of three images on the right.
In the single exposure above, the background standard deviation is about 7.4. In the median combine image it is only 1.7. For noise removal, the median combine method works best. This can be seen below.
Above: On the left, an average of three images. On the right, a median combine of the same three images.
Notice that small specks and streaks are still visible in the averaged image, while they have disappeared from the median image. The average function works by summing the pixel values of all the images and then dividing by the total number of images. Median works by simply taking the middle pixel value from the set of images. If there is an especially bright pixel in one image which is not in the others (for example, from a cosmic ray strike), that high value will raise the average value and still appear bright in an averaged image. However, extreme pixel values tend to be cancelled out in the median combine since the middle value is taken, regardless of how high or how low the minimum and maximum values may be.
As an example, in a set of 5 images, if a pixel has values of 950, 975, 980, 995, and 12,000 (the high value being from noise such as a cosmic ray), the average value will be 3180 and the pixel will appear bright in an averaged image. However, using the median combine process, the value of 980 is selected and the bright deviation is effectively cancelled out.
Note: Median combining requires at least three images, whereas averaging can be used with only two images. When median combining an even number of files, the two middle values are taken and then averaged.
Above: Three images which have a background value of 50% grey. In one image there is a dead pixel with zero value, and in the last image there is a hot pixel whose value is the maximum (100%).
Above: The left image is an average of the three images from the previous diagram. It can be seen that, while reducing the effects of the artifacts, the hot pixel tends to raise the average leaving a brighter spot, and the dead pixel tends to lower the average leaving a darker spot. The right image is a median combine. Since the median takes the middle value, regardless of exceptionally high or low values, the artifacts are eliminated.
Sigma-Clip & Similar Methods
A more advanced routine is the sigma-clip combine method. Similar methods include sigma-reject and standard deviation mask methods. Sigma-clip offers an improvement in reducing spurious noise sources such as cosmic rays. Median combine normally does a good job removing these artifacts (as the oversimplified example above showed), but median combine does not do as good a job of reducing plain old random noise. Sigma-clip determines the mean value of the pixels in all the images, rejects the pixel value with the largest deviation, then recalculates a new mean value from the remaining values. An improvement in signal-to-noise ratio can be realized with this method vs. standard median combining, but only if sufficient images are used. Typically 6 or more images are necessary to see an improvement.
For more details, see the CCD Theory webpage on Optimum Exposures and Understanding Signal-to-Noise Ratio.
Standard Deviation Addendum
What does all this background standard deviation stuff really mean? Here are some images to demonstrate the effect of various standard deviation values.
Above: Cropped and 2x enlarged background images. The first image is a single exposure and has a standard deviation of about 19. The second image is from a sum of 2 images and has a standard deviation of 7.8. The third image was created by summing 4 exposures; the standard deviation is only 3.2.