New Feature : Improved Star detection in Multi-star FWHM Focus

Discussions, Bug Reports and Issues related to Beta versions of SharpCap
User avatar
admin
Site Admin
Posts: 6354
Joined: Sat Feb 11, 2017 3:52 pm
Location: Vale of the White Horse, UK
Contact:

New Feature : Improved Star detection in Multi-star FWHM Focus

Post by admin »

Hi folks,

this week's update has been delayed as I have spent a considerable amount of time working on an improved star detection routine. So far this is active in Multi-star FWHM focus only, but if it is successful then I will expand the use to other areas such as live stacking and polar alignment.

The goal was to both increase the sensitivity of star detection (to allow stars to be detected in situations where they previously could not) and to simplify the various options associated with star detection - to make it more likely to 'just work'.

What are the changes in the new version?

1) There is no need to specify a 'black level' value any more. In the old star detection this told the code to ignore the dark background of the image (below the 'black level'). The new code works out the background automatically (and also takes account of variations in the background across the image).

2) There is no 'minimum star width' setting any more - this was used to try to eliminate hot pixels, but now there is a simple check box to suppress hot pixels which can be used with noisy cameras.

3) There is no 'digital gain' any more - setting this wrong could cause more problems than it solved and you had no way of seeing the effects.

4) Instead of digital gain there is an option to 'Use Display Stretch' this means that if you have made stars show up by using the stretch functionality of the mini-histogram, the star detection code can be set to use the stretched image instead of the unstretched image.

5) The code now calculates something closer to the HFD (half flux diameter) than the FHWM. The HFD can be used for all the same calculations as FWHM, but is usually considered to be a more stable and robust measurement of star size. I haven't changed the name of the measurement though - that would just confuse people.

6) Because HFD is better than FWHM, there is no Minimum brightness any more - HFD allows a reasonable estimate of the size of a star no matter how dim it is. There is still a maximum brightness because taking measurements from saturated stars is inaccurate.

7) There is a Sensitivity control - turn this up to detect more stars, turn it down to detect less. Like any sensitivity, if you turn it too high then you could start detecting things that are not stars (hot pixels, warm pixels, noise, etc). Under certain circumstances, SharpCap can detect that this has been set too high (basically if the number of detected stars is very large). When this happens, SharpCap will automatically turn down the sensitivity 1 point per frame until a reasonable value is reached.

8) There is still a noise reduction control. I really wanted to get rid of this, but sometimes when the image is very noisy you need to reduce the noise to get star detection to work. Adding noise reduction all the time tends to cause problems in less noisy images with small stars. In the end there still needs to be a noise reduction control, but it should only be used as a last resort.

9) The new code can detect much bigger (further out of focus) stars than the old code - I have seen out-of-focus samples work out to 20-25 pixel FWHM. Because of this the 'No stars found' value for the focus graph has been changed from 20 to 50 - it needs to be a value higher than any reasonable real measurement.

10) The number of stars needed for a measurement has been reduced from 10 to 5.
Capture.JPG
Capture.JPG (21.48 KiB) Viewed 487 times
Some guidelines for using the settings:

Start with the defaults :
Suppress Hot Pixels : On
Use Display Stretch : On
Sensitivity : 75
Max Brightness : 95%
Noise Reduction : 0.0

In most situations, only adjust the sensitivity
Turn it up if not enough stars are detected. If too many stars are detected, or noise/hot pixels are detected as stars, or star detection reacts very slowly then turn the sensitivity down.

If your stars are mostly very faint, use Display Stretch
Applying a display stretch to brighten the stars helps the star detection code find them. This can be very helpful for finding faint stars (particularly out of focus ones). Note that the measurements of FWHM/HFD are based on the true pixel values, not the stretched ones.

Other tips:
If your frames are very noisy, use the noise reduction option. A little extra noise reduction can also improve the speed of star detection if it is slow
If you are using a large pixel camera that is undersampling, you may get very small stars - you might need to turn off hot pixel suppression

Very keen to hear any positive or negative reports on this.

cheers,

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

Re: New Feature : Improved Star detection in Multi-star FWHM Focus

Post by admin »

Here's an example of detecting a very faint image (kindly provided for testing by a forum user)

Without any stretch, the image is almost completely black - no stars detected :
nostretch.JPG
nostretch.JPG (151.91 KiB) Viewed 482 times
Applying a stretch (just hit the auto-stretch button) and a quick tweak of the sensitivity and enough stars are detected to focus nicely
Capture.JPG
Capture.JPG (237.56 KiB) Viewed 482 times
cheers,

Robin
roelb
Posts: 113
Joined: Wed Mar 08, 2017 11:36 pm

Re: New Feature : Improved Star detection in Multi-star FWHM Focus

Post by roelb »

Will the new feature "Suppress Hot Pixels" also available in Stacking?
Roel
Celestron Nexstar Evolution 8 - Celestron Nexstar 6 SE - OTA 5 SE - StarSense
Starlight Xpress Lodestar X2 Mono -- ZWO ASI290MM -- ZWO ASI224MC -- ZWO ASI533MC-Pro
JesusRL
Posts: 53
Joined: Wed Aug 05, 2020 4:36 pm
Location: Madrid

Re: New Feature : Improved Star detection in Multi-star FWHM Focus

Post by JesusRL »

Hi Robin,

I have started testing it and it's an excellent improvement.

Some notes:

Star detection works fine most of the times with the correct display stretch applied (with my setup). If it's run in autofocus as part of a sequence there should be a possibility to aply autostretch otherwise may not work.

When used as part of a sequence the parameters of max step count and scan step size are stored. If you open the transform manually later it keeps the values inserted in the sequence ignoring the ones defined in the transform. You need to change them in their combos to use the shown values.

In case of error at the end of the autofocusing routine it remains at that end point. Wouldn't it be better to go back to the focusing point where it was before autofocus?

After testing it about a dozen of times in some ocasions (about 1/3 sorry for imprecission) the routine has failed due to some error in the HFD calculation. I think it's because of that because I am using 10 images per sample point and the 'error' is persistent in the set of 10 images. see image:

https://drive.google.com/file/d/1XJmwoN ... sp=sharing

In all the tests I have done FWHM behaves in a more regular way than HFD meaning that ALL points are very close to the estimated curve:

HFD https://drive.google.com/file/d/1ABBxV9 ... sp=sharing
FWHM https://drive.google.com/file/d/1MQmY0w ... sp=sharing

Hope some of this may help.

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

Re: New Feature : Improved Star detection in Multi-star FWHM Focus

Post by admin »

Hi,

thanks for the feedback - it's very useful.

I have already made sequencer steps to apply autostretch and reset the stretch (they will be in the next update).

I was expecting HFD to be more stable, so it is a surprise that it is not :( More investigation required!

For the problem with the single measurement being wrong, do you think that is a single really bad measurement mixed in with 9 good ones or 10 that are all bad? I really should add logging of the measurements during focus scan to allow us to go back and check this sort of thing!

thanks,

Robin
JesusRL
Posts: 53
Joined: Wed Aug 05, 2020 4:36 pm
Location: Madrid

Re: New Feature : Improved Star detection in Multi-star FWHM Focus

Post by JesusRL »

I am sorry but cannot specify how many are good or bad in 10 frame set.

But my guess was: the average is the green triangle and the upper an lower lines are the max an min of the set.

If this is the case something has happened with this specific focus setting that creates someting in the image that breaks the algo.

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

Re: New Feature : Improved Star detection in Multi-star FWHM Focus

Post by admin »

Hi,

I think I may have discovered the cause of the bad readings - if some frames (at random) have too few stars, then they get a score of 50. That gets averaged in with all the other frames, but will obviously make a big impact on the average if all the others are scoring 7.

For the next update I'm changing the code so that if you have 9 good scores and one '50' invalid score then it will only average the good scores.

I'm also changing the invalid value from 50 to 25... Using 50 makes the graph get too small to see nicely as it forces the vertical axis to be 0..50

Robin
roelb
Posts: 113
Joined: Wed Mar 08, 2017 11:36 pm

Re: New Feature : Improved Star detection in Multi-star FWHM Focus

Post by roelb »

Will the new feature "Suppress Hot Pixels" also available in Stacking?
Roel
Celestron Nexstar Evolution 8 - Celestron Nexstar 6 SE - OTA 5 SE - StarSense
Starlight Xpress Lodestar X2 Mono -- ZWO ASI290MM -- ZWO ASI224MC -- ZWO ASI533MC-Pro
User avatar
admin
Site Admin
Posts: 6354
Joined: Sat Feb 11, 2017 3:52 pm
Location: Vale of the White Horse, UK
Contact:

Re: New Feature : Improved Star detection in Multi-star FWHM Focus

Post by admin »

Hi Roel,

yes, my intention is to make this star detection available across all SharpCap features (stacking, polar alignment, etc). I just want to try it in one place first to iron out any bad bugs.

cheers,

Robin
JesusRL
Posts: 53
Joined: Wed Aug 05, 2020 4:36 pm
Location: Madrid

Re: New Feature : Improved Star detection in Multi-star FWHM Focus

Post by JesusRL »

Hi Robin,

:D :D :D
- Many more stars found
- 6 succesfull focusing procedures en 3 diferent fields
- 0 failed

From my point of view it works

T&R
Post Reply