Live stacking algorithm

Somewhere to ask questions about the best way to use SharpCap
Post Reply
chuckscap
Posts: 3
Joined: Fri May 12, 2017 3:44 am

Live stacking algorithm

Post by chuckscap » Fri May 12, 2017 3:47 am

Is there a setting for the live stacking algorithm (average, median or accumulation (addition))? If not, can you tell me what the default algorithm is?

Just getting started in EAA with my new ZWO ASI224MC but used to image a bit. I'm mainly interested in DSO EAA

Thanks!

User avatar
admin
Site Admin
Posts: 651
Joined: Sat Feb 11, 2017 3:52 pm
Location: Vale of the White Horse, UK
Contact:

Re: Live stacking algorithm

Post by admin » Fri May 12, 2017 6:01 am

Hi,

it's an adding algorithm (which is fundamentally the same as averaging). Median would be nice but I think it would require too much memory, but I will try to add sigma-clipping at some point in the not to distant future.

cheers,

Robin

chuckscap
Posts: 3
Joined: Fri May 12, 2017 3:44 am

Re: Live stacking algorithm

Post by chuckscap » Sat May 13, 2017 1:32 am

Hi Robin, just a beginning EAA person, but I've done some imaging. I see a lot video astronomy images with stars "blown out". I think, and I may easily be wrong, that addition is the same as averaging until you saturate. In some others applications we have used the following algorithm which is very fast. Let's say you average the first four images then for each pixel you save that average value, then on each succeeding frame for every pixel:

n = the number of images averaged
prev_ave = the previous average

new pixel value = ((prev_ave * n) + new value ) / (n +1)

The new pixel value is now your average for the next frame. That way the computations do take an additional multiply and divide, but no more storage than just addition.

Just a thought,

Best Regards,

Chuck

User avatar
admin
Site Admin
Posts: 651
Joined: Sat Feb 11, 2017 3:52 pm
Location: Vale of the White Horse, UK
Contact:

Re: Live stacking algorithm

Post by admin » Sat May 13, 2017 9:25 pm

Hi Chuck,

if you add and have a maximum limit that you can reach (say 65535) then you get problems with clipping/saturation. SharpCap's maximum limit is 2.1 billion, so you would need to stack 32000 16 bit frames, or 16+ million 8 bit frames to hit the clipping limit!!

The averaging algorithm you quote is identical in effect to the adding algorithm that SharpCap uses as long as you don't hit the limit (which as pointed out above you won't) - they give the same results except for a scaling factor of the number of frames, and the SharpCap code takes care of this scale factor automatically.

Whether the current representation will survive then I offer the option to sigma-clip I'm not sure - for sigma clipping you have to track the variance of the stacked values at each pixel as well as their mean/sum - that lets you work out the standard deviation (sigma) and then you can reject pixels that are too many sigmas away from the mean.

Having looked into this a bit more it's clear that a true median value stacking algorithm is not possible in SharpCap because to calculate a median you need to either know the number of things you are averaging and keep at least half+1 of them, or if you don't know how many things you are averaging you need to keep all of them! So in order to do a true median stacking, SharpCap would need to remember every single frame in the stack so far and process *all* of them every time a new frame arrived! This would quickly run out of memory and be far too slow! (Note that stacking software like DSS can do median stacking as it has the advantage of knowing how many frames it is working with, also it can work through the image in small parts and it doesn't have to re-stack after each new frame).

cheers,

Robin

chuckscap
Posts: 3
Joined: Fri May 12, 2017 3:44 am

Re: Live stacking algorithm

Post by chuckscap » Sat May 13, 2017 11:49 pm

Thank you for the explanation. I think Sharpcap is amazing even though I have just started to use it. My past experience is solely with a Canon DSLR doing image processing no live stacking. So thanks again

Best Regards,

Chuck

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest