A Couple of small feature requests

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: 485
Joined: Fri Jan 01, 2021 7:25 pm

Re: A Couple of small feature requests

#21

Post by Borodog »

Yes, I have the SER file from the focus sweep. I'll upload it and post a link.

Sounds like all my settings, although I have been trying much larger numbers of samples to try to bring down the error bars, 10 - 20. Like I said, it often seems like the score jumps after a focus motor move and it spends a long time coming back down.
User avatar
admin
Site Admin
Posts: 17530
Joined: Sat Feb 11, 2017 3:52 pm
Location: Vale of the White Horse, UK
Contact:

Re: A Couple of small feature requests

#22

Post by admin »

Hi,

thanks, that will be very useful - I am still looking into improvements in this to see what is possible. Doing some testing I did find that the 'contrast range' score doesn't work particularly well if the focus selection box extends outside the planet, but seems fine if the box is entirely within the planet area. I got good focus curves from all three planetary focus score systems, although this was in simulation (real camera with short exposure and high gain, real lens+ motor focuser, but looking at an image of jupiter since that allows me to test during daylight hours).

cheers,

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

Re: A Couple of small feature requests

#23

Post by Borodog »

I don't know how I could keep a small focus box inside the confines of the planet, especially with feature tracking not working. Maybe with a guide scope or OAG, which I don't have for my 1100.

Here is the focus sweep SER file:

https://drive.google.com/file/d/1ALKpPT ... share_link
User avatar
admin
Site Admin
Posts: 17530
Joined: Sat Feb 11, 2017 3:52 pm
Location: Vale of the White Horse, UK
Contact:

Re: A Couple of small feature requests

#24

Post by admin »

Hi,

thanks for the SER file - I will now have to do something like make the folder monitor camera read SER files or similar so that I can play it back through SharpCap. Fortunately SER is a simple format :)

For keeping the focus selection box inside the planet, how about using the 'planet/disk stabilization' option in the camera preprocessing controls - that offsets each frame to keep the planet (or whatever bright blob you are looking at) central. It can't track long term like feature tracking, but it works on a frame-by-frame basis and should be good enough for a focus run.

cheers,

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

Re: A Couple of small feature requests

#25

Post by admin »

Hi,

I have had a bit of time now to analyze the SER file and at least understand a few of the things that are going on.

Firstly, my version of AS!3 gives an odd drop in the quality graph after about frame 9000, the same as yours does. This seems to be an AS!3 issue, since if you pre-process the SER to remove the drift of the planet, it largely goes away. I used both PIPP and some custom code based on the SharpCap image stabilization to make a pre-aligned SER which shows a much smaller drop in quality after frame 9000.
Capture.PNG
Capture.PNG (6.11 KiB) Viewed 1328 times
This shows that actaully the scan stops somewhere just after the point of best focus, with very little of the move away from best focus included in the video. My guess is that the best focus is at about frame 8000 or so.

Interestingly, when I analyze the frames in SharpCap's focus score code, I see exactly the same sharp dropoff after about frame 9000 in the Fourier code - I suspect in this case it's something to do with the fact that from about frame 9000 onwards there are some significant slewing movements to try to recenter the planet. While it is hard to spot in the individual frames, it's possible that the movement is blurring things slightly. The fourier score suggests a best focus point at about 7000 rather than the correct(ish) value of 8000.

The 'Contrast (Edge) Detection' option does the best job of matching the scores from AS!3 - not surprising since the algorithm is very similar. The focus score seems to peak arounf frame 8000 to 9000 or so and there is little sign of a drop towards the end of the video, which is similar to the stabilized AS!3 data. There is no focus point solution here, since we do not have any data for the 'downward' part of the curve - or at least not enough
Capture2.PNG
Capture2.PNG (9.7 KiB) Viewed 1328 times
Finally, the contrast range score has a nightmare wobble. For some reason it seems to show a *minimum* of contrast near to the point of best focus rather than the expected maximum. I don't understand that at all, and I can't make anything similar happen in my testing here, which is annoying. I can't even work out a theoretical reason why that might happen, which is worrying me...

Based on the above, I would recommend working with the 'contrast (edge) detection' setting and the stabilization option turned on to keep the ROI area tracking the same region of the target.

I will continue to look into this to try to work out what on earth is happening with the contrast range approach (among other things).

cheers,

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

Re: A Couple of small feature requests

#26

Post by Borodog »

Sorry; I should have done a less one sided sweep, but I knew I was past the point of best focus so I stopped. I might have another one from last night if I didn’t delete it; I have to check.

I absolutely was having to slew frequently because feature tracking was not working, and I could *see* it messing up the focus scores.
Borodog
Posts: 485
Joined: Fri Jan 01, 2021 7:25 pm

Re: A Couple of small feature requests

#27

Post by Borodog »

I do have another focus sweep SER from last night if it helps, although again I stopped when it was clear I was beyond critical focus.
User avatar
admin
Site Admin
Posts: 17530
Joined: Sat Feb 11, 2017 3:52 pm
Location: Vale of the White Horse, UK
Contact:

Re: A Couple of small feature requests

#28

Post by admin »

Hi,

not sure that another recording will reveal much additional info at the moment. I did find and fix another gremlin that was causing issues with finding the best fit curve when there were lots of data points and a fair bit of noise in the values - this will go into 4.1.

I am still puzzled by the 'inverted' curve for the contrast range score. I tried putting a central dot on one of my test lense to simulate a scope with a central obstruction, but that doesn't reproduce the issue.

cheers,

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

Re: A Couple of small feature requests

#29

Post by Borodog »

I have seen instances of completely inverted curves and M shaped curves where there is a dip, or at least a flat top, at what is clearly critical focus. The last inverted parabola I recall was from last week using the edge detecting method; perfect inverted parabola around critical focus. Most of the time the M shaped or flat topped curves come from the Fourier Detail method in mediocre seeing. It's like the seeing is limiting the details that can be detected. These also cause failures to fit a parabola, presumably because R is too low.

How many points do you recommend having in the focus sweep, anyway?
User avatar
admin
Site Admin
Posts: 17530
Joined: Sat Feb 11, 2017 3:52 pm
Location: Vale of the White Horse, UK
Contact:

Re: A Couple of small feature requests

#30

Post by admin »

Hi,

first the focus points - if you are using 4.0 then there are still issues with large numbers of points (which are now fixed in 4.1), so with 4.0 I would recommend 10 to 15. You will need at least 3 points each side of the calculated best focus point, and ideally they should show a significant decrease in score.

I finally tracked down the cause of the inverted graph for contrast range focus score - I was using the standard deviation of the pixel brightness as a measure of the range of brightnesses. For some images, blurring can increase the standard deviation (which I still don't really understand). However, a measure of the range between the 2nd centile and 98th centile of brightnesses seems to be robust in terms of showing an increase at better focus and a reduction when the image is blurred.

I think there could certainly be cases where the blurring caused by misfocus may not be the biggest component of image blurring when close to best focus (seeing, diffraction, etc can all contribute too). In those cases you would expect to see a moderately flat central section to the graph, possibly with some noise, between two wings where the focus score falls away. As long as the scan covers enough ground to include the wings then the best fit curve should pick the center of the flat section in most cases as the best focus point.

How the contrast detection could be inverted is a new mystery - no idea about that one at the moment!

cheers,

Robin
Post Reply