Improving Signal-to-Noise Ratio by Image Stacking
 

Improving Signal-to-Noise Ratio by Image Stacking

It's possible to raise the signal-to-noise ratio when imaging a static subject by taking several photos and averaging them. But how fast does the ratio improve?

Table of Contents

1. Problem

2. Setup

3. Results

4. Interpretation

5. Testing

6. Appendix: Sensor Noise Modeling

6.1. Readout Noise

6.2. Shot Noise

 1. Problem

When taking photos of the starry sky, especially when using a fixed mount, you have to balance a number of variables. One of them is the maximum exposure time and the presence of star trails. If the exposure time is short you get no star trails, but you also get no image unless you crank up the sensor gain (ISO) which gives you noise. If the exposure time is long you can shoot at a lower ISO and thus lower noise levels, but the sky will be smeared out due to the rotation of the Earth.

The rule of thumb is that the maximum exposure time for full frame cameras should be "600 / focal length" seconds and "360 / focal length" for DX / APS-C size sensors. So, for example, if you put a 10mm lens on your full-frame camera, your maximum exposure time is 60 seconds. If you put it on your Nikon DX camera, you are limited to 36 seconds.

In practice I've found it even more limiting. On my Nikon D3200 and Sigma 10-20mm f/4-5.6 EX DC, I've found that 20 seconds is about the maximum before the star trails start becoming apparent.

Since I'm limited to a static mount most of the time, I wanted to know this: how many exposures at a given ISO do I need to average to get the same noise level as I get at ISO 100?

Cambridge in Colour[a] claims that it scales linearly with ISO: You need two exposures at ISO 200 to get the noise level at ISO 100, two at ISO 400 to get the noise level of ISO 200, four at ISO 400 to get to ISO 100, and so on.

Statistics and quantum mechanics, on the other hand, claim that it is non-linear: the sensor has a fixed readout noise[b], and there is also a shot noise[c] that is proportional to the square of the light received at the sensor. The result is that you would need more than two photos at ISO 200 to get to the noise level at ISO 100.

Let's test that.

 2. Setup

I did a number of 30 second exposures at various ISO settings, and measured the signal-to-noise ratio of the center 2000 by 2000 pixels (of a 6000 by 4000 RAW file). The signal-to-noise was measured as  SNR = mu / sigma , that is, for every pixel, the standard deviation from the mean of the brightness values in a small region centered on the pixel. The exposures were then stacked, and the signal-to-noise ratio was measured for the result after one, two, three and four images had been stacked.

 3. Results

Signal-to-noise ratio for a given ISO and number of images stacked. The first averaged image that has better signal-to-noise ratio than a single photo with one step lower ISO is marked in green. [Expand]
ISO1234
10030.24   
20021.4530.1436.6641.98
40015.6621.8626.5230.34
80010.5614.6617.7220.27
16006.719.3411.3012.89
32004.576.297.558.59
64002.713.674.374.93
128001.932.643.153.56
Signal-to-noise ratio for a given ISO and number of images stacked.

A single ISO 100 image is displayed for reference as a solid line.

 4. Interpretation

We see that it takes roughly between two and four images at a given ISO before the signal-to-noise is better than a single photo at the ISO one stop lower. Using a rough linear interpolation we can place the point somewhere between the integral number of images.

Number of images needed to get the SNR of the next lower ISO [Expand]
ISON
2002.0
4001.9
8002.3
16002.6
32002.3
64003.4
128002.1

Here we note that the scale appears linear up to ISO 400, which in this test actually manages to be slightly sub-linear, but that all ISOs above 400 are super-linear. (I think the ISO 400 and ISO 6400 values are anomalies, but they will do for the level of accuracy I'm aiming for.) Using the numbers from above, we can estimate how many photos we would have to stack at each ISO to get the same noise level as a single ISO photo at a lower ISO.

Number of images needed to get the SNR of the lower ISO [Expand]
ISO100200400800
2002---
40042--
800953-
1600241263
32005527146
6400185894721
128003921879943

Here we (again) see that it is nice and linear up to ISO 400. ISO 800 is only off by a single exposure, requiring nine exposures instead of eight. Then the number of exposures start to climb a lot: ISO 1600 requires 24 exposures instead of 16, ISO 6400 requires a whopping 185 exposures instead of the 64 exposures a linear model would require, and ISO 128000 requires more than three times the number of exposures a linear model predicts.

 5. Testing

Since I end up shooting a lot at 20s / ISO 800, I wanted to verify the result for at least that ISO level. Here are the signal-to-noise ratios after stacking N exposures at ISO 800:

SNR after stacking N ISO 800 images [Expand]
NSNREquiv. ISO
110.56
214.66
317.72400
420.27
522.42200
624.30
726.10
827.53
928.93
1030.24100
1131.12
1232.31
1333.45
1434.51
1535.45
Signal-to-noise ratio for ISO 800 and number of images stacked. The 100, 200 and 400 lines are the signal-to-noise ratios of single images at that ISO.

The result is slightly worse than predicted, but at least proves that the number of images required grows faster than linearly.

 6. Appendix: Sensor Noise Modeling

The sensor is modeled as a single pixel, a counter that counts incoming photons. It has a minimum and a maximum number, with the minimum being zero and the maximum being some arbitrary value, say 12,000. During an exposure, incoming photons are counted as they arrive. Then the number is read out and multiplied by the ISO, which results in the final image brightness value begin recorded in the RAW file.

This sensor suffers from two types of noise: readout noise and shot noise. We will look at the sensor's behavior in two cases: One at an exposure at ISO 100 (base ISO) and one exposure at one tenth the time, but at ISO 10,000 (100 x base ISO). For example, 30 s @ ISO 100 vs. 0.3 s @ ISO 10,000. Furthermore, in order to keep the numbers manageable, we'll not multiply with the ISO, but with the ISO divided by the base ISO to get the final brightness level; so the ISO 100 exposure will be multiplied by one, and the ISO 10,000 exposure by 100 (since 10,000 is 100 times the base ISO of 100).

 6.1. Readout Noise

Readout noise is the accuracy with which we can read the number of photons that were captured. This is a constant number, which depends on the sensor and which we will set to ±100.

Let's say we do the 30 s @ ISO 100 exposure and the sensor has registered 10,000 photons. Then the readout may then be anywhere between 9,900 and 10,100, and this is the final brightness value. The signal-to-noise ratio is  (10,000) / 200 = 50 , or conversely, the noise level is 2%.

Now we do the ISO 10,000 exposure. Since we only expose the sensor one hundredth as long, we only capture 100 photons. The readout noise, however, is just as large, so the readout can be anywhere between zero and 200 photons, which we then multiply by 100 to get a final brightness value between zero and 20,000. In this case, the signal-to-noise ratio is  100 / 200 = 0.5 , and the noise completely overwhelms the signal.

 6.2. Shot Noise

Shot noise is a quantum mechanical effect where the sensor may or may not register an incoming photon simply due to the laws of nature. The amount of shot noise is proportional to the square root of the number of incoming photons. Let's do the same examples as above again, and now look at a sensor with no readout noise, but with shot noise.

First up, the ISO 100 exposure. 10,000 photons are expected to impact the sensor, which means that our shot noise is  sqrt(10,000) = 100 . The sensor will thus register anywhere between 9,900 and 10,100 photons. As before, the signal-to-noise ratio is  (10,000) / 200 = 50 , or conversely, the noise level is 2%.

Then comes the ISO 10,000 exposure. Since we expose the sensor one hundredth of the time, we expect to get 100 photons. This means that we get less shot noise -  sqrt(100) = 10  - however, since we get much less signal as well, the amount of noise relative to the signal increases. When we read out, we will get a count between 90 and 110, which gives us a signal-to-noise ratio of  100 / 20 = 5 , or 20% noise.

[a]

http://www.cambridgeincolour.com/tutorials/image-averaging-noise.htm

[b]

https://monochrome.sutic.nu/2015/10/16/improving-signal-to-noise-ratio-by-image-stacking.html#readout-noise

[c]

https://monochrome.sutic.nu/2015/10/16/improving-signal-to-noise-ratio-by-image-stacking.html#shot-noise