As part of an investigation in to the effectiveness (or otherwise) of DSLR dark frames, I have hit something of a brick wall and am in need of some advice regarding my methodology and some puzzling findings. As ever, I expect I have overlooked something obvious or made a stupid mistake, but here goes:
I am trying to test different methods of selecting subframes to integrate in to a master dark. In one of the tests, my aim is to evaluate the Signal to Noise ratio of the set of darks and select a subset that gives the highest SNR in the resulting master dark. (By
signal I mean the dark current, and by
noise I mean the combination of read noise and dark current noise). N.B. I am aiming to use dark fame optimisation in PI, which does seem to work well, so the objective is to give the least noisy and best match to the true dark current in the camera as the starting condition for the scaling routine to work with.
- Step 1 was to calculate the mean of each dark subframe, which should be a reasonable proxy for signal since there are no 'features' in the dark to speak of.
- Step 2 was to calculate the standard deviation of each dark sub, again this should be a reasonable proxy for noise.
- Step 3 was to calculate the SNR estimate as SNR (frame) = 20 * LOG10 ( Mean (frame) / StdDev (frame) )
I took 183 dark subs at a variety of temperatures between 6C and 25C (non-temperature controlled Canon 500D), all for the same 600 second exposure and at ISO400. These were plotted on the graph below:
![](https://lh3.googleusercontent.com/-1fgwGhrO66U/U1aGj_NlPuI/AAAAAAAADYY/pIn9P-RAcws/w1075-h688-no/snr1.png)
The dark blue line is the mean of each subframe (plotted on the right hand axis in ADUs). The red line is the standard deviation (plotted in ADUs against the left hand axis). You'll note the usual problem of Canon Dark Frames, i.e. for most of the graph the Mean reduces as the Standard Deviation increases, when we'd expect both to increase. At the far right you'll notice that both the Mean and the Standard Deviation increase rapidly. I'm not surprised by this as this replicates Craig Stark's experiments quite nicely - the camera reduces the appearance of dark current for less bright frames but then seems to switch to a different mode, creating a 'hockey stick' curve. (Crag found this by increasing exposure times, whereas I have replicated it by increasing sensor temperatures for the same exposure time - logically they are equivalent as more dark current should accumulate for longer exposures and/or higher sensor temperatures).
My suspicion for the hockey stick is that there is some internal look-up table and the camera is using this in conjunction with measurements from the optical black area of the sensor to apply a scaling factor to all or some parts of the image. At some point(s) the algorithm is using a different value in the table causing a reversal in the effect on mean vs. stddev. It's probably a bit more complex than that, but it feels sort of right.
As an aside, the EXIF temperature is only a very rough guide to this relationship, you'll get a better result by looking at means and standard deviations; there is not a as close correlation between standard deviation and EXIF temperature as you might assume. The EXIF temperature is a rough guide, but there is a lot of variation for frames with the same reported temperature and a lot of overlap in mean and standard deviation ranges for different temperatures. I am assuming the temperature probe is not that representative of the average temperature of the whole exposure.
Finally I sorted the SNRs of each subframe (see Step 3) in descending order and plotted them as the green line (this is in dB, against the left hand axis again - bear in mind that we have both ADUs and dB on one axis here - clearly not the same thing, but conveniently the results are in a similar numeric range so I can save creating a second graph so long as you keep the units for each line in mind!)
- Step 4 was to calculate the expected SNR of a master dark integrated from n frames as SNR (master) = 20 * LOG10 ( SUM ( mean(frame 1) .. mean(frame n) ) / SQRT( SUM ( Stdev(frame 1)^2 .. Stdev(frame n)^2 ) ) )
I think this is the correct calculation, and it is plotted as the purple line on the graph (again in dB against the left axis). The curve is what I'd expect to see from integrating increasing numbers of frames - i.e. a rapid increase in SNR early on, followed by a tailing off in improvement as more and more frames are added. What was interesting is the far right of the curve; you can see from the green line that there is a rapid drop-off in SNR for the individual subs at about 179 frames. This is due to the fact that we are passing the 'uptick' on the hockey stick curve found by Stark. Integrating these frames slightly reduces the SNR (the purple line curves down at the end).
This was the aim of the method, i.e. to use a reliable measure on the dark frame subs to decide which are adding to the overall SNR of the master dark and which are not. So far so good, but this is where I am coming unstuck.
I next integrated master darks using 30 frames, 60, 90, 120, 150, 178 and 183 (the most I had). The integration method was as described here (
http://pixinsight.com/tutorials/master-frames/index.html) which is the standard reference I think we all use? I didn't get the results I expected, so I tried three methods to see if pixel rejection was causing an issue:
- Method 1 was as described in the tutorial, using
Pixel Rejection (1) Winsorized Sigma Clipping (Low 4.0, High 3.0) and Range Clipping (0.0 Low and 0.98 High) with Normalization set to "Scale + zero offset".
- Method 2 was the same, except Normalization was set to "No normalization".
- Method 3 was the same, except I used "No rejection" to rule out any funnies being caused by the clipping algorithms.
(N.B. For the avoidance of doubt, I am not using Normalization at all under the Image Integration Section, only under the Pixel Rejection section).
I plotted the results of all three on the chart above, as diamond, circle, and triangle markers. The results overlay each other and aren't that clear, so I have plotted them at a larger scale here:
![](https://lh4.googleusercontent.com/-gvriBKJ008A/U1aGjyLNGXI/AAAAAAAADYU/HxMzIY27whg/w1006-h290-no/snr2.png)
As you can see the SNR of 30 frames is slightly higher than that of the best single dark sub (plotted at '1' on the X axis). After this the SNR tails off a small amount as we add more frames, which is exactly the opposite of what one would expect from the purple estimate curve in the first graph (bear in mind this was created from the means and stddevs of the actual frames). I did a couple of extra integrations and the peak does indeed seem to be at about 30 frames - it is rising at 15 frames and falling at 35 and 45 frames (I didn't plot these extra results). The minor differences between the three pixel rejection methods seem reasonable in themselves since the best curve (red) is the one using the most robust method to eliminate outlying hot/cold pixels.
So the question is, why am I seeing the SNR getting slightly worse as I integrate more frames, when one would expect it to get significantly better?Bear in mind the weird pre-processing of Canon RAWs shouldn't nullify improvements in SNR by adding more frames to the stack (unless the SNR of the frames is really low compared to the rest of the set as we see at frames 179+).
So either my theory is wrong (entirely possible), I've made a stupid mistake or incorrect assumption, or something else? Perhaps the results are just not statistically significant enough to be reliable? Maybe using means and standard deviations as estimators of signal and noise in these darks is just way off the mark? Any suggestions gratefully received.
(Please note, I'm
not asking for advice as to whether I should or should not use dark frames, bias frames or magic pixie dust to calibrate my DSLR images. The problem is that I've read so much contradictory advice and conjecture that I want to prove what does or does not work in a robust way rather than guessing or hoping that person A knows more than person B.)