Using Starnet++ to help enhance Nebulae images

This is one of over 100 articles in the author’s Astronomy Digest: http://www.ianmorison.com

In several articles in this digest, I have advocated splitting the image into 2 separate images, one of the stars and one of the nebula, as for example, a galaxy such as M31, the Andromeda Galaxy, or m42, the Orion Nebula.  This enables the nebula regions to be enhanced as described in the example below and, perhaps, the stars reduced in size before adding back to make a combined image.  This also allows the star brightness to be reduced so that they become less prominent in the image.  

In these articles I have suggested that one applies the ‘Dust and Scratches’ filter to the original image with a pixel size, of say 12 pixels, which is adjusted to suit the stellar image size.  This does a pretty good job of removing the great majority of stars coupled with the use of a clone tool to remove those bright (and hence larger sized) stars that remain.  If this ‘starless’ image, called ‘Nebula’ is copied and pasted over the original image and the two flattened using the ‘Difference’ blending mode, an image of the stars alone, called ‘Stars’ is produced so giving one image of the nebula and one of the stars.  These two images can then be manipulated separately as described below.

The software program Starnet++ has been in development for a few years and has now reached maturity.  It is memory and processor extensive and will not run on computers built before 2011 – but it does work extremely well.  The developers state that ‘StarNet is a neural network that can remove stars from images in one simple step leaving only background.  More technically it is a convolutional residual net with encoder-decoder architecture and with L1, Adversarial and Perceptual losses.‘  [What does this mean?]

As a ‘command line program’, it  does not have a graphical interface and requires a little use of a text editor.  Once the software package has been downloaded and unzipped into the ‘Downloads’ folder (and then perhaps copied into a specific folder for easier access) one need to do a little editing of the command line to be used.  Let’s assume that an RGB image is to have its stars removed.  One needs to right click on the Windows Batch File ‘run_rgb_starnet.bat’ and enter the Text Editor to alter the command to say  ‘rgb_starnet++.exe in.tif out.tif 64.  

The name of the image to be processed (as an rgb Tif file) is then changed to ‘in.tif’ and copied and pasted it into the Starnet++ folder.  One then simply double clicks on the command line and a window appears showing the process in action.  With a high resolution image the process will take some time!   When the process is finished, one simply closes it by pressing any key.   There will now be a file in the folder called ‘out.tif’ which should be copied into the appropriate folder for further processing.

An example: the Andromeda Nebula imaged from a light polluted urban location.

The image below shows the output having aligned and stacked 50, 30 second, exposures in Sequator (see article in the digest).  Given the light pollution present it is perhaps surprising that any image of the galaxy can be produced. 

As also described in the digest, the light pollution can be removed from the image but its presence will mask out the outer, fainter, parts of the galaxy.  The image below shows the resultant image.

This image was then split into the Nebula and Stars images using Starnet++ and Adobe Photoshop.  [The excellent and low cost program Affinity Photo could equally well be used.]

Processing the Nebula Image

The ‘halos’ left around some of the brighter stars were painted out with a black brush.

To increase the ‘local contrast’ of the Nebula image, the ‘Unsharp Mask’ filter was used with a large radius and small amount.  The ‘Smart Sharpen’ filter was also used with a small radius and amount.  (The values used for these two filters need to be found by trial and error.)  This was the result.

Processing the Stars Image

One might, perhaps, reduce the star sizes to make them less prominent in the final image.  The best way for this to be implemented is to download, the now free, program called ‘Images Plus‘.  The Stars image is loaded into it and, within the ‘Special Functions’ menu, is found the ‘Starsize, Halo, Shape Reduction…’ tool which enables one to reduce the star sizes to give the result shown below having increased the image saturation slightly to enhance their colours.

All that remains is to combine the two images: the Stars image is copied and pasted over the Nebula image and the two layers flattened using the ‘Screen’ blending mode. Pleasingly, the brightness of the stellar images can be reduced if desired by reducing the opacity of the Stars layer.  The final result is shown below which, given the light polluted location from which it was taken, could be a lot worse. 

There is a new version of an astroimaging software package called Siril which now uses a graphical interface. One current problem is that there is little information as to how it is to be used in its new form. However I have been able to use it to apply a ‘Photometric Colour Calibration’ to the image. The full resolution image of the above (as a 16-bit Tiff file) was loaded and, in the ‘Image Processing’ drop down menu, ‘Colour Correction’ was clicked upon giving two options. The ‘Photometric Colour Calibration’ was selected which opens up a window as shown below.

In this window, I entered the RA and Dec co-ordinates for M31 and also the focal length (500 mm) of the telescope and pixel size (8.4 microns) of the camera sensor. The NOMAD Photometric Star Catalogue was left as default and ‘OK’ clicked. The program then ‘plate solved’ the image and, presumably, corrected the colour balance to give the result below which I find very pleasing indeed.

Photometric Colour Correction using the Siril astroimaging software.

[Sadly, due to ‘lockdown’ restrictions, I am unable to go to a dark sky site to produce a better initial image.]