Official Request for Improved Autofocus in SGP

Hello Ken and Jared,

First off, I wanted to thank you guys for SGP. It has generally transformed my imaging from a process that required a lot of manual intervention and me staying up most if not all of the night, to one that is mostly automated and allows me to sleep through my imaging sessions.

There is one thing about SGP that keeps me babysitting the process throughout the early part of each night, however. I wanted to make an official request for improved Autofocus in SGP. I think there have been various topics on the issues people are often encountering with the feature, however I do not know that any have officially made an explicit request for the autofocus feature to be revamped and enhanced to support the features and capabilities we really need.

SGP’s AF feature has a lot going for it, and feature wise I like what it offers…the focus offsets, backlash compensation, the configurability for how often and when AF is run, temp compensation, etc. Those are all great. The key issue that I am hoping can be resolved lies in the AF algorithm itself. I think there can be improvement there, both in terms of reliability and robustness, as well as in terms of speed.

I won’t reiterate what other threads cover. I am just here to ask if we could get some improved reliability, robustness and speed in the AF process. Starting with speed, the ability to use hardware ROI if the camera supports it, so we can download just the necessary small areas of the frame for focus, should help greatly speed up the process. Ideally you could run the whole process in under a minute, even with 10-15 samples. Once the process is faster, I am hoping the algorithm could be revamped with more robust validation of each run. Take multiple samples per focus point, use some kind of basic outlier rejection to eliminate bad samples, and verify that the slopes of the regressions for each V curve are within an acceptable threshold, stuff like that.

There are also some other things I’d like, but they would be secondary to speed, robustness and reliability. In particular, I have had a tough time getting temp compensation working with certain scopes. It would be interesting to see a feature that would allow me to pre-configure AF frequency on a curve throughout the night, and perhaps even by the height of the object above the horizon. I usually have to focus every 10 minutes early in the evening until things settle, at which point I can shift to every 20 minutes then every 30 minutes. Once my target starts to slip lower in the atmosphere, I sometimes find I need to focus more often again. Being able to define a curve of AF frequency would be quite handy…but certainly a “nice to have”.

I would like to see the internal SGP algorithm improved, as SGP has a lot of other things going for it on the AF front, including it’s integrated focus offset and temp compensation capabilities. I have noted calls for support for external options, however that entails additional cost, another API to integrate with, and possibly a loss of features and functionality (depends entirely on the third parity options integrated with.) I think SGP just needs improved robustness in its algorithm so that the process is more reliable…and it needs a speed boost so it doesn’t take several minutes each time it runs.

12 Likes

I wish to thank Jon Rista for his well worded and well thought official request for improved autofocus in SGP. Like him, I have become invested in SGP due to its many automated features that have improved my imaging with increasing confidence of a successful hands-off night coupled with a much appreciated good night’s sleep. The developers are to be commended for their achievements and continued commitment to producing an excellent, state-of-the-art software package.

To that end, I also request that the autofocus feature be improved with attention to speed as well as statistical accuracy with a more robust algorithm. This advancement, coupled with many of AF’s existing detailed features and parameter settings, will improve SGP’s performance and image production even more.

Thank you for your contribution to astrophotography, and I look forward to seeing what you achieve next with such an advancement!

Best Regards,
Ben

Well said, Jon.

I love what Ken and Jared have done with SGP but better, more consistent AF could make this great program stellar (pun intended). :slight_smile:

Glenn

Any changes to the existing model would be welcomed, especially the ROI option Jon talked about (rather than downloading the whole frame and only inspecting a portion of it). Modeling the focuser (a la Focus Max or Voyager’s First Light Wizard modes) would be welcomed as it would completely eliminate the need to tell the focus module what step size to use (thus reducing human input error) and would allow SGP to make some of the more intricate changes Jon eluded to in his post. Users could then just run the Focusing First Light, have a v-curve in place for their system, and use that when they focus with a given profile.

Thanks to Jon for starting this request. Also add my thanks and kudos to the SGP developers. I agree with Jon and all that the autofocus module could use some enhancement. I think at least the use of subframes, and some sort of focuser modelling routine would be a huge improvement.

Joe

Ditto from me. Subframe especially.

Thanks Jon,

I too love SGP and the autofocus algorithm is probably its weakest feature in this program. I will not be switching to an alternate since I am very well adjusted to SGP. However, I would like to add my vote to this request also.

thanks,

Cfosterstars

1 Like

Yes, I’ve actually been contemplating this a lot recently because of “some other tread on some other site…”. I’m not entirely sure what directly this is going to take. But initial thoughts are to improve the existing auto focus as well as provide some external mechanism for other parties to integrate with SGP. The latter piece may or may not happen. But minimally we probably need to provide a single star option as well as some improvements to the multi star option that currently exists.

Thanks,
Jared

4 Likes

" use some kind of basic outlier rejection to eliminate bad samples, and verify that the slopes of the regressions for each V curve are within an acceptable threshold, stuff like that."

I think this the most important.

Max Mirot

Just to add my signature to the petition! I’m a total fan of SGP and couldn’t do what I do without it these days. It is so great to be in direct contact with the developers of a piece of software and for said developers to be so reactive to feedback. Group hug for SGP!! I have had issues with focus and Globular Clusters, so any improvement for that specific issue will be greatly received by me!
Happy Christmas everyone!

I agree. With some outlier rejection and a subframe option, AF could be dramatically improved. One suggestion related to subframes is to allow an “exclusive” option for the subframe. At long focal lengths with galaxies, globs or other similar structures in the frame, the biggest problem is the AF routine picking up the galaxy core. It would be very handy if an exclusion area could be drawn around the offending structure so that it is not included in the HFR calculation.

Tim

Hi

IMO this is a good idea helps people who do not have a flat field to focuse slightly of centre as well
The is a crop feature at the moment - cant be to hard to do the opposite

Harry

I just realize why I do have a very good performance on my focusing. I always move to a nearby focusing target, plenty of stars and no DSO, using the option on the Control Panel à Telescope à Target Markers…

With my setup it takes around 30 extra seconds for going back and for every 0.7 °C ambient temperatura change which should be around 6 to 8 extra minutes per night, not bad. This includes the time it take for PHD2 to start guiding again.

My setup: 100 mm f/5.8 scope and QSI660 camera on a Mach 1 mount.

Anyway, having subframe capability should be an excelent improvement (May be I will eliminate moving my scope for focusing).

Renan

Thank you Ken and Jared for creating SGP and thank you Jon for such a well worded post. My experience using SGP almost exactly mirrors Jon’s, as such, the paragraph I quoted from Jon embodies my exact feelings about what would really improve autofocus in my imaging sessions.

Best Regards
Derek

Support many of the ideas in this thread. Especially a more robust way of dealing with bad data points. Breeze and barely visible high cloud can both throw off the AF routine. Having said that SGP’s AF better than the one built into Maxim 5, at least for me.

Hi All,

I’ll add my support for he OPs request and the various comments along the way. The big one that gets me though, is that using an SCT, the “roll-over” or whatever others have called it when you get too far out of focus and it starts ignoring the bigger rings and assuming that focus has improved is a real problem. There has to be a way to improve the detection algorithm. I realize that if you’re starting from way off focus that’s challenging, but if you’re just refocusing, it would be easy to optimize the process. Maybe that’d be a place to start. Have two different focus routines. One for finding focus initially and one with a narrower range to tweak the current focus. After all, once I’m in focus and just trying to tweak a bit of temperature drift, I don’t need to cover the whole span, just a bit around where I am.

Then, if you’re starting from nearly in focus, it would make more sense to take a shot of what you have currently, choose those stars as guidance for what to use when calculating the out of focus condition. Obviously only the brighter stars will be detected when you’re well out of focus, so an algorithm that carries over information from each previous frame rather than just searching for stars on the current frame independently (which I assume is what happens now) would be better able to follow when things go way out of focus. I’m not exactly sure how you’d reverse that for starting way out of focus, especially for an SCT, but that would be the ideal long term goal.

Of course this also ties in with the subframe request by the OP, since the choice of the subframe to use would start from deciding where the best star(s) are and planning to track those through the focus routine.

Anyway, just some thoughts in addition to saying yeah, this should probably be very high on the development list! =)

Thanks,

Beo

1 Like

Agreed! Any improvements to AF accuracy and speed would be welcome.

John

Subframe option would be an awesome start. I raised this a couple of years ago when it was acknowledged as a good idea and again a couple of weeks ago although sadly no reply to that post. At the moment with full frame downloads of 30 seconds AF is to restrictive on time with the large QHY11 chip.

I have a different take on this. I certainly see the desirability of fast focusing based on a subframe or even a single star for those with slow cameras and/or non-flat fields.

But my camera is fast and my focal plane is flat. I’m more interested in an improved and more robust focusing algorithm that uses contrast rather than star diameter (FWHM or HFR)as the focus quality metric. Examples are @focus3 in TheSkyX and SKSS by InnovationsForesight.

Like SGP, these algorithms use the whole image rather than subframe a star or small region. Unlike SGP, they do NOT use star diameters but rather use straightforward image processing to evaluate the focus. The TSX approach is especially nice because it works for nebulosity or galaxies just as well as it does for stars. In fact, contrast0based autofocus is the basis for daytime photography and @focus3 works just fine for ordinary daytime images.

I support the idea of subsetting a ROI and doing HFR calculations on tiny fast-downloaded images, especially if the user can specify where on the image the ROI should be subsetted.

But I’d also like to see an optional algorithm based on contrast rather than star diameters. This would be especially helpful for NB imaging of non-stellar targets.

1 Like

The only disadvantage I can see about using ROI vs the whole image is if you use AF using ROI for example, it’s possible that the focus outside of ROI may not be well focused. So using the whole image for AF, it can help to make the whole image look more pleasing than focusing at only ROI. This is assuming the whole image could have optical imperfection that the focus may not be not equal throughout the whole image if the center of ROI is perfectly focused. In other words, if you focus only at the ROI could cause the whole image to look out of focused. Not all telescope systems are created equal in terms of focus.

If you want to increase the speed of focusing, try binning to next level like 2x2, 3x3, or even at 4x4. Binning should not always affect the quality of focus.

Peter