Gradient Removal Improvement

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.
Cey42
Posts: 52
Joined: Tue Nov 10, 2020 3:47 am

Gradient Removal Improvement

#1

Post by Cey42 »

I am not sure if this post belongs here or not.

The current Gradient Removal feature works well but I believe it could be better. I normally practice EAA and do not post-process my images. Being in Bortle 7 skies, I often experience light gradients and having this feature work even better would be great.

Here is an example without Gradient Removal. The gradient is visible from the top left to the bottom right.
NoRemoval.jpg
NoRemoval.jpg (196.16 KiB) Viewed 1402 times


With Gradient Removal. This is a big improvemnt from the previous image but the bottom middle part is not quite right.
WithRemoval.jpg
WithRemoval.jpg (226.04 KiB) Viewed 1402 times


Now using PixInsight Automatic Background Extractor, (default params) which takes less than 2 seconds to run. A much more even background.
PI-ABE.jpg
PI-ABE.jpg (86.94 KiB) Viewed 1402 times


You can get the fit files and flats from here. https://1drv.ms/u/s!AmzOfpCoABCRgd0udIU ... w?e=dYAfl6

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

Re: Gradient Removal Improvement

#2

Post by admin »

Hi,

thanks for sharing the images - I will try to have a look shortly. The current background removal uses a linear model for the gradient to be removed, so it will only partially work when the gradient has more complex variation in it. From your screenshots it looks like there may be more of a defined edge to the background (rather than a smooth transition), although that might be the results of stretching of the image...

cheers,

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

Re: Gradient Removal Improvement

#3

Post by Borodog »

Even just quadratic would be a significant improvement, although obviously not a magic bullet.
User avatar
admin
Site Admin
Posts: 13362
Joined: Sat Feb 11, 2017 3:52 pm
Location: Vale of the White Horse, UK
Contact:

Re: Gradient Removal Improvement

#4

Post by admin »

Hi folks,

I have put together some code that will try to fit a 'bi quadratic' to the background brightness pattern (I think it really works out to be a conic section). This is not yet something that you can select in the background removal drop down, but will get added there when I have done some more testing and fine tuning of the code.

It will be interesting to see how the more complex fit works out - once you add second order terms, it's possible for the fit to start to try to match to regions of *real* brightness in the image - for instance an M31 image has a lovely ellipsoidal bright area which might get picked up. The fitting algorithm is least absolute deviation (actually, least deviation to a power of slightly less than 1 to further reduce the tendency to be pulled around by outlying values), so it should only take account of the largest scale features, but then adding higher order terms works in the other direction...

cheers,

Robin
Cey42
Posts: 52
Joined: Tue Nov 10, 2020 3:47 am

Re: Gradient Removal Improvement

#5

Post by Cey42 »

I am so happy to hear that you improved this. If you want me to test it out, I have plenty to test. I am fine testing with a beta version.

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

Re: Gradient Removal Improvement

#6

Post by admin »

Hi,

thanks for the offer to test - I still have to wire in the UI to actually make this something that you can turn on!

cheers,

Robin
Cey42
Posts: 52
Joined: Tue Nov 10, 2020 3:47 am

Re: Gradient Removal Improvement

#7

Post by Cey42 »

I finally got around to looking at the 4.1 beta and see you have added this. Here is an example on one image. I over-stretched to show it clearer. Looks like it is over-correcting. Tell me if you want the files.

Without GR.
NoGR.jpg
NoGR.jpg (212.33 KiB) Viewed 1169 times
With Linear GR
LGR.jpg
LGR.jpg (210.32 KiB) Viewed 1169 times
With Non-linear GR
NLGR.jpg
NLGR.jpg (168.22 KiB) Viewed 1169 times
User avatar
admin
Site Admin
Posts: 13362
Joined: Sat Feb 11, 2017 3:52 pm
Location: Vale of the White Horse, UK
Contact:

Re: Gradient Removal Improvement

#8

Post by admin »

Hi,

I'm afraid I'm not entirely surprised - the linear gradient removal only has three variables that need to be solved, non-linear second order has six, which means there are a lot more ways that it can find seemingly good fits to the data that don't do what we would like.

Can you share the original frame at full resolution without any stretching applied please? It would be interesting to see if the cliff edge running diagonally is real or is a stretching artifact. Also to look at what values are calculated for the background grid and how well the curve fits them.

cheers,

Robin
Cey42
Posts: 52
Joined: Tue Nov 10, 2020 3:47 am

Re: Gradient Removal Improvement

#9

Post by Cey42 »

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

Re: Gradient Removal Improvement

#10

Post by admin »

Hi Cey,

thanks for sharing - I'm away at the moment, but will download that and have a look later in the week.

cheers,

Robin
Post Reply