Combining Images Using Integer and Real Type Pixels
A common procedure used to increase the signal to noise ratio
("S/N") of images is to combine them in software by mathematically
merging the pixel values of the individual images. Image combining
is sometimes termed “stacking”. Increasing the signal to noise ratio
improves the detection of weak features and shows fainter objects,
and it improves the significance of any measured quantity like
magnitude, surface brightness, edge sharpness, centroid position,
etc. Image combining can also remove deviant
pixels that do not differ from one image to another simply because
of random noise. A deviant pixel might also be caused by a cosmic ray hit
or radioactive decay, as CCD's are extremely sensitive to such
radiation events. There are various method available for combining
images to blend the goals of increasing the signal to noise ratio
and removing non-repeating artifacts. In the limiting case of best
performance, combining can improve the S/N by the square root of the number of
images combined. For example, combining 16 images of the same field
of view can increase the S/N as much as 4 times. Removing artifacts
such as cosmic rays reduces the theoretical gain to somewhat less
than sqrt(n). Balancing the objectives of increased S/N and reduced
artifacts involves choosing from a variety of different combining
methods. This Tech Note considers two commonly used methods, the
Mean and the Median. It also describes the additional effect on the
ultimate S/N that results from combining images and saving the
result using integer type pixels and real type pixels..
Results
A set of 8 images was obtained from a CCD camera. The images were
then combined using the Mean and Median methods. The processing was
then re-done after changing the images from integer to real type
pixels. All processing was done
using Mira. These images were acquired using a 12 bit CCD camera,
but the same general result applies to any other bit depth such as
16 bits per pixel.
The pictures show a magnified views of the combined images for the 3
of the 4 results. On each close-up is written the standard
deviation "sigma", the combining method, and the pixel data type.
All values are reported in units of DN ("Digital Number", also known
as ADU or Counts). Cases (a) and (b) compare the mean and median for
integer type pixels. Case (c) shows the mean combination with the
result saved as real type pixels. The missing case of median
combining and real pixels is considered further below. Progressing
from left to right shows a progressive improvement in the signal to
noise ratio of the combined images.
For
all cases, the images were normalized as part of the combining
procedure in order to make the overall image brightness similar
before pixels were combined. This makes the principle difference
between the brightness of the combined images attributable to random
noise, allowing the combining process to do the proper statistical
thing by "beating down the noise". The noise value, or "sigma"
(standard deviation), was measured inside a rectangular cursor box
placed in a clear area of the image background. This area was chosen
after greatly stretching the contrast to make sure no objects or bad
pixels were included in the measuring box. The noise value listed on
each image quantifies the visual impression that image (c) is the
cleanest--it has the highest signal to noise ratio. This image was
mean combined and stored in real pixel format. The reason the saved
image format matters is that saving to an integer image involves
truncating the combined value to the nearest integer value.
This imparts an additional noise value of 1/sqrt(12) counts to each
pixel (for a discussion of quantization noise, or truncation noise
and its effects on CCD photometry, see Newberry, M. V., 1991, Pub
Astr. Soc. Pacific., vol. 103, p.122 ).
The
pictures below compare the mean and median method using only real
type pixels for the saved images. Note that a slightly different
sample region was used for
the statistics in this set, so the sigma for the "mean, real" image
below
is not exactly the same as for the "mean, real" image above.
Again, the mean combining gives the lower noise result.
This is
clearly shown by the two small galaxies located near the top right
corner of the images.
Median combining a given number of images increases the S/N about
80% as much as mean combining the same number of frames. This loss
of potential gains in S/N results from the fact that the median
continues to select a value that is a member of the set of input
pixel values, no matter how many frames are combined. Both combining
methods also have a "hard" limit that occurs when adding more frames
stops changing the combined pixel value by 1 digital number (count).
This limit is overcome if the pixel type is changed from integer to
real so that fractional pixel values can be represented at all
stages of image processing, including the saved result. This
latter effect is shown by images (b) and (c) in the uppermost
pictures.
Median combining can give a S/N similar to mean combining if 57%
more images are used. The origin of this number is that the variance
of a median-combined sample is pi/2 (= 1.57) times higher than for a
mean-combined sample. The standard deviation is the square root of
the variance, or 1.25 times higher. The noise resulting from
mean-combining is then 1/1.25 as large, or 80%, of that achieved by
median-combining.
Conclusions
When combining images, the best signal to noise ratio is achieved by
selecting the "mean pixel value" method. Further improvement is
obtained by saving the image in 32 bit real pixel format. Median combining
can completely remove cosmic ray hits and radioactive decay trails
from the result, which cannot be done by standard mean combining.
However, median combining achieves an ultimate signal to noise ratio
about 80% that of mean combining the same number of frames. The
difference in signal to noise ratio can be compensated by median
combining 57% more frames than if mean combining were used. In
addition, variants on mean combining, such as sigma clipping, can
remove deviant pixels while improving the S/N somewhere between that
of median combining and ordinary mean combining. In a nutshell, if
all images are "clean", use mean combining. If the images have mild
to severe contamination by radiation events such as cosmic rays, use
the median or sigma clipping method.
|