Monday, May 27, 2013

The Art of Stacking Images

Most photography enthusiast who knows a bit about manual control is aware that higher ISO means brighter image at the expense of grainier image and in the case of digital cameras, higher noise. This is true for all types of digital cameras, be it pro-level DSLRs to your average Joe's point and shoot digicams. Noise in small sensor cameras are more prone to noise due to several reasons. Digicams typically uses a small sensor and lens, this translates to less light received by the sensor. In order to achieve the same brightness at a typical sensitivity of ISO 100, for example, the amplifier gain needs to be increased. As with any electronic amplifiers, high gain equals higher noise level.

A very noisy image

There are several ways to reduce noise. One way is to apply digital blurring. This lets the user perceive the effect of reduced noise at the expense of sharpness. This technique, although widely used, doesn't really reduce the noise, but rather blend the noise color, eg. pink pixel, with the surrounding pixels. Most image noise cleaning software uses this technique. A better way of decreasing noise is by stacking images. This technique actually increases the signal-to-noise (S/N) ratio of the image, by combining several images to form one cleaner image. This technique although good, needs to have a stationary target and several images. On moving targets, you're out of luck.

After blurring, noise is reduced at the expense of sharpness


A simple explanation of this technique is this. Noise is assumed to be on random pixels and actual image data is at a consistent point. When 2 images with a similar signals are averaged out, the result will be similar (eg. average of 1 and 1 is 1). Noise on the other hand, due to its' random nature, may not exists on the same pixel location between 2 images(eg. average of 1 and 0 is 0.5). By combining 2 images, the signal-to-noise ratio is increased, meaning noise is reduced by half. By combining many images together, noise becomes negligible.

The illustration below shows the result of stacking 3 images. As more images are combined, the noise signal becomes weaker and weaker until only the real signal remains.




Sample image:

1 image, no stacking

2 images stacked

4 images stacked

 8 images stacked

From the sample image above, the difference of a single image and 8 stacked images is obvious. The amount of graininess is greatly reduced when many images are combined. After stacking, the image will be cleaner and we can post process it a bit to improve the sharpness. Sharpening an image can induce some noise specks, but it will be up to the person how much he wants to sharpen the image.



To stack manually, images are loaded as layers. To stack 2 images, for example, one image's opacity should be set to 50% making it half transparent, the bottom image is set to 100%. Once aligned, merge the 2 images. For more images, repeat the process merging 2 at a time. Several images can be merged together at the same time, but aligning them will be harder and opacity ratios will be calculated, for example when using 3 images, set the 3 layer's opacity to 100%, 66%, 33% respectively.

Screenshot of Gimp using layers to merge images


In wildlife photography, stacking more than 1 image is harder because an animal tends to move and vegetations can move due to wind. There are some cases where they just stay still, like the bird picture above. The same technique is widely employed in astrophotography.

While most celestial objects do move a lot as well, their perceived motion is very slow from our vantage point several million miles away. The effects of heat wave and atmospheric disturbances are also nullified by stacking. Stacking, not only reduces the noise, it can also improve the amount of details in an image. Astrophotographers usually stack dozens of frames for deep sky image and hundreds to thousands of images for planetary and high magnification images. With thousands of frames from a video clip, they don't manually do it by hand, there exists tools like Registax to help automate the task of aligning and stacking images.

An example of Jupiter image is shown below:

Clockwise from top-left: Single frame, stacked image, wavelet filter applied, post-processed









No comments:

Post a Comment