Presentation is loading. Please wait.

Presentation is loading. Please wait.

What’s in a sum? Simon Dawes CMHAS. www.itslifejim.btinternet.co.uk Should you stack frames using Mean, Median or Sum?

Similar presentations


Presentation on theme: "What’s in a sum? Simon Dawes CMHAS. www.itslifejim.btinternet.co.uk Should you stack frames using Mean, Median or Sum?"— Presentation transcript:

1 What’s in a sum? Simon Dawes CMHAS

2 www.itslifejim.btinternet.co.uk Should you stack frames using Mean, Median or Sum?

3 www.itslifejim.btinternet.co.uk Objective: To capture an image that closely represents reality by taking multiple images and stacking them to reduce noise. To understand when to perform a sum, average or median stack

4 www.itslifejim.btinternet.co.uk Stacking basics Stacking is performed after the images are aligned Stacking is a ‘pixel math’ operation, i.e we perform a mathematical function on related pixels in each frame The most common stacking options are sum, average and median. Because adjacent pixels are not included in the function we can safely consider a single pixel A AA A

5 www.itslifejim.btinternet.co.uk Our ‘perfect’ image 1x1 pixel image Without noise, we can expect this image to have a value of 1000 We have taken 12 frames of the same image, but our image contains… Random noise due to the instrumentation A cosmic ray 10071012995991100722221006987101199010051007 1000

6 www.itslifejim.btinternet.co.uk Average Stack Average stack simply takes the average of all the pixels (1007+1012+995+991+1007+2222+1006+987+1011+990 +1005+1007)/12 = 1103 This is 110% of the value we were expecting, primarily because the 2222 value (cosmic ray) has a large influence over the result. In real life, with a 1 Mega pixel camera it would be impractical to remove the frames with cosmic rays. 10071012995991100722221006987101199010051007 1000

7 www.itslifejim.btinternet.co.uk Sum Stack Sum stack is simpler than the average stack as we simply add up all the pixel values (1007+1012+995+991+1007+2222+1006+987+1011+990 +1005+1007) = 13240 At first light this looks useless, 13 times higher than the value we are after, but in reality, all we have done is increase the range of values in the image. The sum stack contains no more or less information than the average stack, it is simply 13 times larger. 10071012995991100722221006987101199010051007 1000

8 www.itslifejim.btinternet.co.uk Let’s recap… Mean stacked images contain the same information as sum stacked images

9 www.itslifejim.btinternet.co.uk Yes but… Mean stacked images… require processing (we have to add and divide) require more processing (we have to add and divide) May lose information because the number of decimal places will be truncated Are convenient if you wish to keep the same scale as the original image

10 www.itslifejim.btinternet.co.uk Median Stacking Median (mid point) A reminder… Take a list of values… 12,23,11,17,18 Place them in order… 11,12,17,18,23 The middle value is the median = 17

11 www.itslifejim.btinternet.co.uk Median Stack Place the values in order… 987,990,991,995,1005,1006,1007,1007,1007,1011,1012,2222 find the middle value.. find the middle value.. 987,990,991,995,1005,1006,1007,1007,1007,1011,1012, 2222 =1006.5 This is 0.6% larger than the desired value compared to 10% of the sum and average stack. It’s easy to see what is happening… The ‘cosmic ray’ value is not close to the signal value so is unlikely to be towards the middle of the range of values, effectively it’s ignored. The same will work with aircraft and satellite trails 10071012995991100722221006987101199010051007 1000

12 www.itslifejim.btinternet.co.uk So you should always use a median stack? Not necessarily… Median stacks only work if the frames are of the same exposure time Median stacks require a lot of processing so with a large CCD array and a large number of files can take a long time to process.

13 www.itslifejim.btinternet.co.uk More advanced stacking options Sigma Clip & SD Mask Combine the best features of the Median and Average modes, but require more intensive calculations. Both algorithms work by calculating the mean value of each pixel across all of the input images, as well as the standard deviation of those pixel values. When using the Sigma-Clip algorithm, the pixel value that deviates the most from the mean will be discarded, provided that the deviation is greater than the number of standard deviations given by the Sigma Factor, and a new mean will be calculated without the discarded value. SD-Mask calculates the mean, median, and standard deviation for each pixel. A trigger level is calculated based on the Sigma Factor entered by the user, multiplied by the standard deviation averaged over many pixels. For any pixel where the standard deviation exceeds this trigger level (i.e. a noisy pixel), then the median value is saved in the output image; otherwise the mean is used.

14 www.itslifejim.btinternet.co.uk In summary It is preferential to use a Median stack if the exposure times are the same. If the exposure times are different use a sum stack. The mean stack should be used rarely, and only if you don’t want to change the range of values in your image. Other more complex stacking algorithms can be used that try to identify and eliminate the noise before calculating the new pixel value.


Download ppt "What’s in a sum? Simon Dawes CMHAS. www.itslifejim.btinternet.co.uk Should you stack frames using Mean, Median or Sum?"

Similar presentations


Ads by Google