Cosmetic Correction / Bad Pixel Rejection

Got an idea for something that SharpCap should do? Share it here.
Forum rules
'+1' posts are welcome in this area of the forums to indicate your support for a particular feature suggestion. Suggestions that get the most +1's will be seriously considered for inclusion in future versions of SharpCap.
Borodog
Posts: 330
Joined: Fri Jan 01, 2021 7:25 pm

Re: Cosmetic Correction / Bad Pixel Rejection

#11

Post by Borodog »

Although I do want to note that I don't think this feature is necessarily specific to the 533 or 571. What I'm envisioning, generalized bad pixel rejection , would be helpful even with a higher dark noise camera, a camera with amp glow, an uncooled camera, or all of the above.
Borodog
Posts: 330
Joined: Fri Jan 01, 2021 7:25 pm

Re: Cosmetic Correction / Bad Pixel Rejection

#12

Post by Borodog »

Dr. Glover,

My apologies for the delay. Here you will find zip files of frames from my ASI533MC, 20 frames each lights, darks, flats, biases. If it matters the temperature set point was +10C, gain 101, brightness 5, exposures 15s (lights and darks) and 150ms (flats), wred = wblue = 50.

https://drive.google.com/drive/folders/ ... sp=sharing

Thanks for looking at this.
User avatar
admin
Site Admin
Posts: 13173
Joined: Sat Feb 11, 2017 3:52 pm
Location: Vale of the White Horse, UK
Contact:

Re: Cosmetic Correction / Bad Pixel Rejection

#13

Post by admin »

Hi,

thanks for the files - I have downloaded them all, but it will take me a while to work through the testing/processing/statistics needed to analyse the best approaches.

cheers,

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

Re: Cosmetic Correction / Bad Pixel Rejection

#14

Post by admin »

Hi,

just a quick update on this - I have spent some time analyzing the 533 frames (particularly the dark frames) shared by @Borodog. I have also created some equivalent frames on an older camera (294 sensor) to compare the analysis with the 533. What I have learned so far is...

1) The total variance within 533 camera dark frames is dominated by a small number of hot pixels (maybe 200-400, accounting for ~75% of the variance). The remaining variance after ignoring the hot pixels is in relatively good agreement with the read noise of the camera, but a bit higher.

2) Variation in values of individual pixels between dark frames is in good agreement with the read noise, as you would expect

3) There is a small amount of pattern noise in the dark frames, but subtracting a dark does not work so well to remove it as on the 294. For instance if you divide the 533 darks into two batches and make two 'master darks' - m1 and m2, you find that the variations in pixel brightness across m1 can only explain about 13% of the variations in m2. For the 294 camera, the equivalent figure is 44% (rising higher with larger numbers of frames going into the master darks).

4) You can find hot pixels easily in the dark frames, but trying to calculate which pixels are hot from light frames has not been successful so far - this may not be possible as it is too easy to mistake stars with small width and hence just 1 or 2 bright pixels for hot pixels.

So, what is clear is that dark frames are less useful for the 533 than the 294, I haven't yet got to the point of working out if (hot pixels aside) the darks actually help at all or not for the 533. I will continue to investigate :)

cheers,

Robin
Borodog
Posts: 330
Joined: Fri Jan 01, 2021 7:25 pm

Re: Cosmetic Correction / Bad Pixel Rejection

#15

Post by Borodog »

Thank you for working on this, Dr. Glover. I'm sure that it can be done, as SiriL or DSS for example can stack uncalibrated lights with pixel rejection quite handily. I've made test shots with the 533 with no darks, flats, or bias at all with my f/4.75 refractor and the results after stacking SiriL were great. It's difficult to envision how a star could result in a single or even a pair of apparently hot pixels; theoretically all stars in the frame are convolved with the same atmospheric turbulence kernel and will have (at least) the same HFD or FWHM as the center stars, the exception being for very short focal lengths where you are very under-sampled and the image scale is larger than the seeing kernel, where perhaps hot pixel rejection becomes inappropriate (e.g. Sony's "star eater" algorithm). I think the key is probably to be somewhat conservative in rejecting pixels; hence the default 3 sigma cutoff most often used. I think that would knock out the most egregious hot pixels that end up marring a live stack; anything else can be left up to dithering. In any event, I have confidence in you!
User avatar
admin
Site Admin
Posts: 13173
Joined: Sat Feb 11, 2017 3:52 pm
Location: Vale of the White Horse, UK
Contact:

Re: Cosmetic Correction / Bad Pixel Rejection

#16

Post by admin »

Hi,

so a further update on this - still not the good news anyone is hoping for I'm afraid.

I have spent some time trying different approaches to detecting hot pixels in light frames and still cannot find a robust way to do it. Well, I can detect the hot pixels (or some of them) no problem, but anything that does that is also detecting incorrect hot pixels in some stars in the image - simply put the brightest pixel in a star can also exceed whatever threshold you set for a hot pixel. I suspect this might be less of a problem in mono data (in colour data you have the RGGB bayer pattern on top of the star brightness, which means that the brighter green pixels stand out more from their dimmer blue/red neigbhours in many cases). Anyway, For all the attempts I have made so far, the idea of being able to spot the same selection of hot pixels that comes out of the dark frames is way off.

The next thing I did was to look at different ways of processing the same data to see if dark frames are really bringing benefit in this case or not. The procedure was as follows:

* Stack all the light frames in live stacking (via folder monitor camera) - no special live stack processing beyond alignment and default stacking option.

1) With no dark frame
2) With a master dark frame created from all the dark frames supplied
3) With the same master dark frame, but using code that has been 'hacked' so that the dark is only used for hot pixel correction, not subtraction.

In each case I saved the result as a 16 bit stack, then inspected the output files to look at the amount of noise in the darker parts of the image (methodology - calculate mean and standard deviation of all pixels up to and including 50 ADU above the upper quartile brightness level - this includes over 99% of pixels in the calculations, but is excluding almost everything above background level).

Test 1) S.D of darker areas : 11.574 ADU (No dark)
Test 2) S.D. of darker areas : 7.758 ADU (Full dark subtraction)
Test 3) S.D. of darker areas : 11.572 ADU (Dark for hot pixels only)

What that clearly tells us is that on the statistical level, darks are still doing a useful job of reducing noise in the image, even with newer low noise cameras. What might get lost in this analysis is the effect of any slight gremlins in dark subtraction leading to raining/walking noise etc - these may affect a relatively small amount of pixels out of about 9000000, so not show up in the statistics even if they are visible to the eye.

My next experiments will involve some ideas I have about processing a dark frame to reduce its noise levels before using it...

cheers,

Robin
Borodog
Posts: 330
Joined: Fri Jan 01, 2021 7:25 pm

Re: Cosmetic Correction / Bad Pixel Rejection

#17

Post by Borodog »

Thank you for the update. I was assuming that pixels would be compared to their neighbors, as you don’t have the ability to compare the same pixel across multiple frames. For example compared to the average of its 4 nearest neighbors, or 8 perhaps, and if the center pixel is greater than some number of standard deviations away from the average it gets replaced with that average.
User avatar
admin
Site Admin
Posts: 13173
Joined: Sat Feb 11, 2017 3:52 pm
Location: Vale of the White Horse, UK
Contact:

Re: Cosmetic Correction / Bad Pixel Rejection

#18

Post by admin »

Hi,

yes, I tried both with the 8 surrounding pixels and with the 4 pixels adjacent and other options. Unfortunately it neither does a terribly good job of finding hot pixels or manages to avoid detecting the brightest pixels in a star as hot in all cases (and the lower the FWHM of your stars, the worse this problem would be).

cheers,

Robin
Borodog
Posts: 330
Joined: Fri Jan 01, 2021 7:25 pm

Re: Cosmetic Correction / Bad Pixel Rejection

#19

Post by Borodog »

Interesting. How do you suppress hot pixels during alignment?
Borodog
Posts: 330
Joined: Fri Jan 01, 2021 7:25 pm

Re: Cosmetic Correction / Bad Pixel Rejection

#20

Post by Borodog »

Thinking about this some more, it may be quite unfair of me to claim that post stacking software can “easily” reject hot pixels; they have the advantage of doing it in post. They compare pixels from each individual frame to statistical measurements across all frames, and while I have made post stacks without darks that look great, they were still dithered.

Still, it feels intuitive to me that it should be possible. It is very easy for a human being to look at an image and see what is a star and what is a hot pixel, particularly with a color sensor, at least until you get very under-sampled, where it just might not be appropriate. Perhaps a 2 layer algorithm? The first pass is as described above; with a low enough sigma to catch most hot pixels (if not all), and a second level that calculates the HFD or FWHM. A hot pixel should have a very low and predictable HFD, while a star’s should be higher. Again, unless you are very under-sampled.
Post Reply