Combining images

Learn Photo Editing

Learn Photo Editing

Get Instant Access

Why do we combine images? To build up the signal while rejecting the noise. The key idea is that the random noise is different in each image and therefore will partly cancel out when they are stacked (Figure 14.1). To be precise, the signal-to-noise ratio in the sum or average of N images is VN times as good as in one image by itself.1

14.1.1 How images are combined Sum

The most obvious way to combine corresponding pixel values is to add them. This is like making a multiple exposure in a camera; every image contributes something to the finished product.

The problem with adding (summing) is that the resulting pixel values may be too high. If you are working with 16-bit pixels, then the maximum pixel value is 65 535; clearly, if you add two images that have 40 000 in the same pixel, the result, 80 000, will be out of range.

1 This follows from the root-sum-square law of addition for Gaussian noise sources. If noise sources N1, N2, ... ,Nn are uncorrelated, then the resulting noise amplitude of their sum is not N1 + N2 +-----+ Nn but rather VN1 + N2 +-----+ Nn.

Figure 14.1. Combining images reduces noise. Left: Single 6-minute exposure of the Helix Nebula (NGC 7293) through an 8-inch (20-cm) telescope with f /6.3 compressor, with Canon Digital Rebel (300D) at ISO 400. Right: Average of three such exposures. Random noise is reduced by a factor of V3 = 1.7.

That may not matter if the only bright spots in the image are star images and you don't mind having them all end up maximum white. In that situation, summing is a good way to strengthen faint objects such as nebulosity.

Average (mean)

The average (the mean) is the sum divided by the number of images. The resulting pixel values are always in the same range as the originals. This is actually the most common way of combining images. As with summing, every image contributes equally to the finished product. In fact, taking the average is exactly equivalent to summing the images and then scaling the pixel values back to the original range.

Figure 14.2. Airplane trail disappears when image is median-combined with two more images. If the images had been averaged, the trail would have remained visible at reduced contrast.

Median

The median of a set of numbers is the one that is in the middle when they are lined up in order. For example, if a particular pixel in five images has pixel values of, respectively, 40,50,53, 72, and 80, then the median is 53.

Unlike the mean, the median is not thrown off if one of the numbers is excessively large or small. As we just saw, the median of 40, 50, 53, 72, and 80 is 53. If you change the lowest number to 0, or change the highest number to 400, the median will still be 53 because it is still the one in the middle.

When you use it to combine images, the median automatically throws away defective pixels, cosmic ray spots, and even airplane and satellite trails, because each of these produces an excessively high value in one image but does not alter the order of the others. If you take the median of several images, one of which has an airplane trail in it, the airplane will not show in the median at all (Figure 14.2). Median combining is especially useful with images of the Orion Nebula (M42), which, when photographed from the latitude of the United States, is often criscrossed by geosynchronous satellites.

Bear in mind that the median is undefined if there are not at least three images. Also, do not confuse median combining with median filtering, which is a way of blurring images by replacing each pixel with the median of a group of pixels.

Sigma clipping

The average gives the best smoothing, but the median has the ability to reject abnormal pixels. Is there a way to combine the two?

That is the idea behind sigma clipping - averaging with abnormal values excluded from the mix. To judge which values are abnormal, the program computes the average and standard deviation (a, sigma), then rejects any pixels that differ from the mean by more than ka where k is a factor you specify, and computes a new average omitting the rejected pixels.

14.1.2 Stacking images in Photoshop

So far we have only discussed image stacking done automatically by astronomical software. Sometimes you'll want to stack images under full manual control using Photoshop or Photoshop Elements. Here is the procedure. It introduces an important concept, layers.

1. Open both images in Photoshop.

2. In the toolbar, choose the Marquee Tool (dotted box).

3. Right-click on one of the images and press Ctrl-A to select the entire image.

4. In the main menu, choose Edit, Copy.

5. Click on the title bar of the other image.

6. In the main menu, choose Edit, Paste.

You have now pasted the second image on top of the first one. However, your goal was to mix them 50-50, so you're not finished yet. Proceed as follows.

7. In the main menu, choose Window, Layers to make the Layers window visible.

8. In the Layers window, set the opacity of Layer 1 (the added image) to 50% (Figure 14.3).

9. Hit Ctrl-+ several times to magnify the image so that you can see single pixels.

ll Layers Channels Paths \ ► |

r

1 1 Normal

v 1 Opacity:

50% ►

I Lock: □ J *f* a RS:

10S% ►

8 J

Layer 1

B

i»l r

Background

1 1

1 »3,

oj

-) €>. JÜ 3

Figure 14.3. In Photoshop, the Layers window controls the way images are superimposed. Set opacity of Layer 1 (the added image) to 50% to mix two images equally.

"R IMG_2834.JPG gi 300% (Layer 1, Green/8)

00®

a

-

v,

l<

>

Figure 14.4. Using the Move tool to align images manually. After setting opacity to 50%, move one image, relative to the other, with mouse or arrow keys.

10. Choose the Move tool, and use the mouse or the arrow keys to move one image relative to the other (Figure 14.4) until they are perfectly aligned.

11. In the main menu, choose Layer, Flatten Image. This combines the layers into one.

Your image is now ready for further processing.

While aligning the images, you may want to set the blending mode (Normal in Figure 14.3) temporarily to Difference. Then, when the images are perfectly aligned, the picture will disappear. Set the blending mode back to Normal before flattening the layers and saving the results.

If you want to combine more than two images equally, a moment's thought will show that you don't want the opacity of each of them to be 50%. (They can't all be 50% of the total.) Instead, combine the first two with opacity 50%; flatten; combine the next one with opacity 33%; flatten; combine the next with opacity 25%; flatten again; and so on. The sequence of percentages, 50%, 33%, 25%, 20%, 17%..., corresponds to the fractions ±, 1, 4, 1, 1, and so on.

14.1.3 Who moved?Comparing two images

If you align two images and subtract rather than add them, you'll see what is different about them. This is a good way to detect the movement of asteroids or satellites in a star field, or to check for novae or variable stars.

Strictly speaking, if you subtract one image from the other, you'll see nothing but the difference, and objects may be hard to identify. Figure 14.5 shows a more practical alternative. In Photoshop, convert one of the two images into a negative (on the main menu, Image, Adjustments, Invert). Then paste it onto the other one with about 30% opacity. If the opacity were 50%, the background stars would be invisible. As it is, the stars and sky background are visible with reduced contrast, and the two positions of the asteroid are obvious (white in the first image and black in the second).

Besides patrolling for novae and variable stars, you can also use this method to compare the results of image processing techniques - to find out, for example, exactly what details were brought out by deconvolution, or what details were lost by JPEG compression.

Was this article helpful?

0 0
Photoshop CS Mastery

Photoshop CS Mastery

Artists, photographers, graphic artists and designers. In fact anyone needing a top-notch solution for picture management and editing. Set Your Photographic Creativity Free. Master Adobe Photoshop Once and For All - Create Flawless, Dramatic Images Using The Tools The Professionals Choose. Get My Video Tutorials and Retain More Information About Adobe Photoshop.

Get My Free Videos


Post a comment