Jump to content

Banner.jpg.b89429c566825f6ab32bcafbada449c9.jpg

Image stacking...dumb question maybe..?


pauldaviesuk

Recommended Posts

Hi all,

Perhaps some one can clear this question up that's been tickling at the back of my mind for ages....?

Image stacking....As I understand it, the various tools out there, whether using the frames of an .avi file for solar system subjects or individual .fits/.tiff/DLSR raw frames for DSOs, only average the frames (after stacking etc) in order to boost the S/N ratio.

So, (for example) if I take 20x30secs frames with my DSLR, plus a set of darks, and flats and a bias frame and throw them at the software tool, I'm going to get a greatly noise reduced 30secs exposure of my subject, which I can then take to PS or whatever for further massaging. This seems to be the general rule with everything I've read/learned on the subject of stacking.

This is all very well, but can I use stacking to sum the frames instead of averaging them, to end up with a 'simulated' (for example) 10min exposure from 20x30secs frames?

I guess, in practice, one'd have to take 20 groups of 20x30secs. Conventionally stack and process each group down to a single image, then add them together.

Am I barking up the wrong tree here?!

TIA

Paul

Link to comment
Share on other sites

The only difference between summing and averaging is that you divide by the number of frames in the average, and don't in the sum...

Average = SUM(all frames)/number of frames

Sum = SUM(all frames)

Data will look the same in either case -- all the numbers will just be scaled up in the summed version.

Link to comment
Share on other sites

hmmm....

Imagine I have 10 frames where the min pixels value is 10/4096 and the max 100/4096 (where 4096 is the max - ie the pixel is saturated).

1) If I average the 10 frames, in the resulting image, the min and max will still be the same...just 90 brightness levels between them between them, all stacked over on the left hand side of the histogram.

2) If I add the 10 frames, in the resulting image, the min and max will be the 100 and 1000, now with 900 brightness values between them, more towards the center of the histogram.

Surely scenario 2 gives a better base image from which to start work in PS?

Paul

Link to comment
Share on other sites

Ah! So that is a slightly different problem then. Here you are being limited by the numerical resolution of your data format. You don't have enough values to properly sample the averaged image, so you're adding in extra noise by forcing the average to be an integer value, rather than a real number like it wants to be.

So yes, in this example, you'd be better summing. However, that's not a fundamental difference between summing and averaging; it is just that the summing is letting you use the data structure better. An alternative, for example, is that you could multiply all your data by a constant number (forty in this case), so that you had the range 400/4096 to 4000/4096, and then do the average. The you are using a much larger range of data values, and not being limited by the sampling in your data values.

Link to comment
Share on other sites

But just multiplying all the data values by a constant would just spread the same datas over a larger range.. the image would get brighter, but appear posterised.

I was talking about adding, for example, 10 seperate images of a given subject that are themselves stacks of images that have already been averaged etc.

The idea would be to generate a set of images to add that have already had their S/N ratios optimised.

I guess I'll just have to wait for a good clear night and try it out and see what happens :)

Link to comment
Share on other sites

Paul, the same issues arise whether you are talking about stacking stacks or not. If you have 20min single subs they are (very roughly) like 1x20 subs but brighter. At the heart of the question is quantisation error. If you are working at lower values and files are being saved with integer values then averaged data is lost in the rounding up or down which may not be the case with higher values. I don't know if your software allows you to store files in floating point format but this significantly reduces data loss since the decimal values come into play when the image is stetched.

Link to comment
Share on other sites

TBH I'm not thinking of any specific software app...I'm just asking it its do-able to stack a bunch of short exposure subs to make 1 long exposure.

ATM, my current imaging set up isn't really able to let me capture more than 30sec exposures, and with the light pollution I get here in London, I don't know that I'd want to go much longer....so you can see that if there is a way to make up a longer exposure from a bunch of short exposures.. I'm keen to find out!

Paul

Link to comment
Share on other sites

Yes you can do this but the advantages over a mean combine may not that great. Not only will you be summing the signal but you will also be summing the noise so this method doesn't improve you s/n ratio any more than a mean combine except for the possible reduction in quantisation error as mentioned above

Link to comment
Share on other sites

Each sub that you take contains signal (see below) and noise.

The longer the sub the more of each that you will get.

This is good for signal, but bad because you also get more noise.

However, by average stacking subs you reduce the noise by the square root of the number of subs that you stack. So, if you take 100 subs you reduce the noise in the averaged image by a factor of 10.

Also consider, if you take short subs, then in the limit they can be short enough that no signal (light photons arrive at the CCD) then the sub only contains noise. No amount of stacking will increase the signal to noise ratio, you simply have no signal.

You need to take long enough subs to capture enough real signal and then stack enough of them to reduce the noise.

That's how I understand it anyway.

Link to comment
Share on other sites

Actually, if it wasn't for read noise short subs would be fine. If the correct average is 1 ADU for a 60 second exposure some subs will record zero signal and others will record 2 but the average will be one. The problem is that only shot noise is averaged out by stacking, read noise stays, it is a constant and cannot be removed. The way to get over read noise is to make it a very small proportion of the overall noise which is done by taking longer subs. However, if you are working with a light polluted sky the background sky glow will soon by a much greater contribution to noise than the read noise so longer subs are less valuable than they are at a dark sky site.l

Link to comment
Share on other sites

MartinB, interesting point about the shot noise and read 'noise'. As I remember it from school mathematically only random noise will average down, is the read 'noise' really more of a 'signal' by definition, if you see what I mean.

Yes, I soon knock up against the sky glow ceiling with my DSI IIc when I extend the exposure time.

It's all a question of compromise, but a better understanding of all these things lets us make better decisions leading to better pics.

Link to comment
Share on other sites

Read noise isn't signal, it isn't the same as the fixed pattern noise which can be removed by bias frames either.

Noise is a very complex subject and I am a long way from fully understanding read noise. It can have a very significant impact on image quality and dynamic range. Also it is of fundamental importance in deciding how long to make your sub exposures.

Craig Stark has written some excleent articles on noise here Articles & Reviews Scroll down to 2009.

Link to comment
Share on other sites

Paul,

If you use say DeepSkyStacker to stack the images, then you put images in with 4096 levels (maybe more,. maybe less...this is just an example). DSS converts each to a 16 bit image during processing....and gives out (potentially) a 32 bit image as the result. I think that's about 4,295 million levels.

So that should more than handle any posterising.

Therefore there is no need to sum, averaging is fine in reality.

Cheers

Simon

Link to comment
Share on other sites

averaging is just about the worst way of combining sub frames. It will alllow all the thermal pixels that were missed or only partially corrected by the darks to show through. You will have hundreds of patches of such pixels all over the frame owing to minor inconsistencies in the guiding. Cosmic ray hits, sat trails and aircraft lights/con trails will all be left in your final image.

You should combine using at least a median method to suppress all of this.

Dennis

Link to comment
Share on other sites

A median is noisier than an average -- for a Gaussian distribution (and you can prove with some statistics). However, it is more robust than an average. Dennis is right that averages tend to get pulled off by outlying values such as cosmics etc, and give you messy looking combined images -- but exactly the same would apply if you just summed up the values in all the images. Remember the only difference to get an average is that you divide the sum by a constant number.

A median combine gets around this, but ideally you want to use an average with a suitable rejection algorithm (e.g. sigma-clipping where you reject everything >3-sigma from the mean) to remove the outlying values. Finding what the suitable rejection algorithm is usually a bit of art for each data set :(

Re: scaling/posterizing. Typically in the final image you want to make white=4096 and black=0 (in a 12-bit image anyway). It doesn't matter if you get there by averaging and then multiplying by a constant (which is effectively what you do when you pull the min/max bars on the histogram in to match the min/max of the data); or by multiplying by a constant and then averaging. Mathematically the two operations are equivalent. Except that in the first case you might worry more about quantisation noise because you don't sample the average values properly (round up or down).

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. By using this site, you agree to our Terms of Use.