New Feature : Background Subtraction

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

New Feature : Background Subtraction

#1

Post by admin »

This is new in SharpCap 4.0.7529 - an option in the pre-processing controls for any camera
Capture.JPG
Capture.JPG (29.86 KiB) Viewed 5203 times
When activated, SharpCap will apply a level shift to each channel of the image, bringing the minimum background brightness down to a low level (~5% on the histogram). If you have light pollution issues, this should have the effect of darkening the background and removing the background colour cast due to the light pollution to a large extent.

Note that due to a lack of clear sky time, this has had limited testing - I'm looking forward to feedback on how effective it is and whether any tweaks are needed.

Robin

Some answers to questions you might have :

* Does this affect the saved image files
?

Just like Dark Subtraction, Flat correction and banding suppression, this does affect saved files *except* for raw images saved during live stacking which are saved before any of these processing steps take place

* What effect will I see when I switch this on?

The background of the image will most likely get darker and any colour cast will be reduced. If you look at the histogram, the initial upslope of the three colour channels near the left of the histogram will be closer together than without this applied.

* Can I stop using dark subtraction if I use this?

No, this helps remove false signal from light pollution from your image - dark subtraction removes false signal caused by the camera itself (like hot pixels and amp noise)

* Can I use this with dark subtraction and flat correction

Yes, this will work with both of those. The background removal is calculated after dark and flat correction.

* Is this useful for a mono camera?


Not really - if you have a mono image then you can remove a constant sky background using the display stretch. This feature is more useful with colour cameras where the sky glow might be strong in the red/green and nearly absent in blue for instance.

* What is the difference between 'Simple Offset' and 'Blended Offset'

Simple offset just subtracts a constant value from the brightness of each pixel in the colour channel - that means that the brightest pixels (from saturated stars) will no longer be full brightness. This could lead to a colour cast being visible in bright stars. Blended offset attempts to correct this - a constant offset is applied below ~90% on the histogram, above that there is a region where the effect is less strong, finally leaving pixels that were at near to full brightness unchanged by the background subtraction.

* Should I use this if I intend to process in DSS/Pixinsight/etc?


Probably not - those tools all have ways to remove light pollution. This is aimed mainly at Live Stacking use (EAA).
User avatar
Menno555
Posts: 1051
Joined: Mon Apr 20, 2020 2:19 pm
Location: The Netherlands
Contact:

Re: New Feature : Background Subtraction

#2

Post by Menno555 »

Sounds very cool this!
Now with the moon again higher, will test this for sure :)

Menno
VCTyree
Posts: 9
Joined: Thu Jan 09, 2020 7:55 pm

Re: New Feature : Background Subtraction

#3

Post by VCTyree »

Testing the SharpCap 4.0 Background Subtract Tool

First, I would like to thank Robin Glover for adding the Background subtract feature to the preprocessing options. I ran some preliminary tests last night (2021-03-21) to see how well this feature performs in my Bortle 8 back yard. I am particularly interested in this feature because I do a lot of astronomy public outreach work with the Los Angeles Astronomical Society (LAAS) at an observatory located in a Bortle 8 zone made worse with a well lit ball field 200 feet from the observatory. We have needed a way to maximize the public experience with imaging that shows the objects being viewed in full color.

The following tests were using this set of equipment:

Telescope Drive: iOptron CEM25EC which has a precision encoder to remove periodic error. Images were done without auto guiding as would be done for public outreach viewing.

“Telescope”: Canon 400mm f/5.6 telephoto lens

Camera: ZWO ASI6200MC Pro, a one shot color camera with a peak QE of 91% - QE is important for maximizing faint object data in light polluted skies.

The first test was to see how well M51 will be viewed using background subtraction at the 10 second sub-exposure setting that we must use at the observatory because the 40-year old telescope drive has 94 arc-seconds periodic error. Background subtract made it possible to view M51 with light position removed within about 20 minutes of stacking. This is a significant improvement over our standard procedures where the object has severe color bias caused by the light pollution.

The next test was to attempt a 240 second sub-exposure using the above mentioned equipment. Images were taken with a 56% illuminate moon located near the meridian with a SQM reading of 18.25 magnitude/(Square arc-second). The M51 exposure run started with M51 at an altitude of about 55 degrees. I selected the 240 second sub-exposure time to make sure that I collected enough M51 photons while limiting the light pollution background to about 25% of the dynamic range of the camera. The results were very good, given the imaging circumstances.

??? Unfortunately, the image could not be copied into this text. I can email it separately if it is of interest.

The screen snap above was taken after 15 frames were stacked (60 minutes of stacking time) with the image of M51 at 100% zoom (I forgot to turn off the reticle before doing the screen snap). There were a few observatons that need mentioning.

First, the live background subtraction left a gray-green background which I believe is related to my particular light pollution situation and also due to the nature of the green channel histogram leading edge relative to the red and blue histogram leading edge. This gray-green background was removed by making a small reduction in the green channel using the live stack color sliders. The resulting stacked image is more than sufficient for public outreach and certainly makes watching the progress of the live stack more pleasing.

Second, I noticed that the drift graph feature stopped working in SharpCap 4.0. I noticed this because I wanted to quantify how much refractive drift was accumulating over the 60 minute stack time.

Finally, a small question about the circle reticle in version 4.0. What are the number labels on some of the circles?

Once again, thank you for including the backgroiund subtract feature.

Regards,

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

Re: New Feature : Background Subtraction

#4

Post by admin »

Hi Vance,

thanks for the comprehensive report - glad to hear that the background subtraction feature was a success for you :)

Firstly, uploading attachments to the forums are limited to a file size of 1Mb - this is simply to limit the amount of data that I have to back up which would grow enormously if the size was unlimited and people were adding 10Mb PNG files or 30Mb FITS files... Usually you can get images under this limit by a combination of converting to JPG and/or reducing the size of the image somewhat. Another option is to upload the images elsewhere (flickr, google drive, astrobin, etc) and to post a sharing link here.

Secondly, the gray/green background - I'm glad it could be edited out easily, but I would be interested in seeing one or more of your image frames without the correction applied to see if I can do a better job in future.

Finally the drift graph - this still works for me. Is there any chance that you have turned off the 'Align Frames' option in live stacking which would disable the graph? If not then I will need to investigate further.

thanks,

Robin
VCTyree
Posts: 9
Joined: Thu Jan 09, 2020 7:55 pm

Re: New Feature : Background Subtraction

#5

Post by VCTyree »

Thank you for your reply. With regard to the Drift Graph, I did remove the tick in the star alignment box because I wanted to see how much refractive drift occurs in a 60 minute stack. I did not realize that this action would disable the Drift Graph, so that explains my observation. I will try again during the next observing session with the star alignment enabled. By the way, is there any to to save Drift Graph data for further analysis?

Getting back to the green cast in my images stacked with Background Subtraction enabled. I did some investigation into what happened. It turns out that the green cast may be caused by the fact that I have a subtitle light pollution gradient in my images even though I included a good master flat frame (and dark frame) in the Live Stack process. I have posted a write-up of my analysis on an image of M97 taken on the same night as the M51 image. The link to my Dropbox is:

https://www.dropbox.com/s/o97wabkgjl2mo ... F.pdf?dl=0

I can also post the “As Seen” PNG file of M97 if you want to view the full image (also posted in the PDF write-up). I can also post the FITS file of the 32-bit stacked image without the histogram processing, but this file is more than 716 MBytes - one of the “problems” with the ASI6200MC camera is the resulting very large file size.
User avatar
admin
Site Admin
Posts: 13122
Joined: Sat Feb 11, 2017 3:52 pm
Location: Vale of the White Horse, UK
Contact:

Re: New Feature : Background Subtraction

#6

Post by admin »

Hi Vance,

Thanks for taking the time to look into the green glow effect in such detail. I think your analysis is spot on – the light pollution gradient across the images not handled perfectly by the simple technique of subtracting the value seen in the darkest part of the image. I do have a plan to enhance the light pollution/background removal functionality in a future version to include trying to detect gradient situations and correct for them, but that's going to come sometime down the line after 4.0.

The only ways I can think of to get the drift graph data is either to do a screenshot (which is hardly very useful) or to try copying all the text out of the live stacking log tab – I think the log entries stored there each timeframe is added include the offsets and rotation, so it may be possible to filter out those entries from the rest of the log and then pick out the values from them. A bit of a roundabout approach I'm afraid :(

Cheers, Robin
VCTyree
Posts: 9
Joined: Thu Jan 09, 2020 7:55 pm

Re: New Feature : Background Subtraction

#7

Post by VCTyree »

Robin -

I was happy to do the analysis for you. I have been thinking about the odd color shifts and gradients for some time. This analysis really made clear to me what has been going on for some time.

I think that what you already have for background subtraction is a vast improvement over what I was doing before. The color error due to the residual gradient in the sky is rather easily corrected with the color band sliders in Live Stack. It will work very well for my astronomy outreach work with LAAS - and certainly requiring less effort than before SharpCap4. I always save the raw stacked image on each imaging run, so I can do a proper gradient removal off-line and post it on my Instagram account if any of the attendees at an imaging session wants to see the final processed image. This is something I have been doing for a couple of years.

Regards,

Vance
User avatar
Tiago Ferreira
Posts: 143
Joined: Sun Mar 21, 2021 10:50 pm

Re: New Feature : Background Subtraction

#8

Post by Tiago Ferreira »

I tried this features on live stacking without success. When i activate them, or only one of them, the image start to have a weird pinkish color that increase frame by frame even if i adjust the histogram. Short exposures used with zwo294.
Youtube channel: https://youtube.com/@DobsonianPower

12" f/5 Dobsonian GSO
8" f/6 Dobsonian GSO
6" f/5 Dobsonian Go-To Virtuoso Gti
Dwarf II Smart Telescope
Geoptik Eartha Eq Platform
ZWO ASI224MC + ZWO ASI294MC
User avatar
admin
Site Admin
Posts: 13122
Joined: Sat Feb 11, 2017 3:52 pm
Location: Vale of the White Horse, UK
Contact:

Re: New Feature : Background Subtraction

#9

Post by admin »

Hi,

could you share a couple of individual frame images (saved without dark/flat) and any dark/flat frames you were using and I will test to see if I can work out what is going wrong.

thanks,

Robin
User avatar
Tiago Ferreira
Posts: 143
Joined: Sun Mar 21, 2021 10:50 pm

Re: New Feature : Background Subtraction

#10

Post by Tiago Ferreira »

I don't save frames on live stack. But next opportunity i will save them for you to check.
Youtube channel: https://youtube.com/@DobsonianPower

12" f/5 Dobsonian GSO
8" f/6 Dobsonian GSO
6" f/5 Dobsonian Go-To Virtuoso Gti
Dwarf II Smart Telescope
Geoptik Eartha Eq Platform
ZWO ASI224MC + ZWO ASI294MC
Post Reply