Star De-emphasizer Script (Adam Block's star reduction method)

astroswell

Member
Dec 20, 2020
24
6
Star De-emphasizer Script for PixInsight

Introduction

This script uses the method of de-emphasizing stars suggested by Adam Block @ngc1535 (https://adamblockstudios.com/). The basic idea is that we need to create a so-called "halos" mask in order to fill the space around each star with the data from the starless image.

The recommended way to obtain a starless image is by using Starnet++ process. But there are other ways too.

I highly recommend watching Adam Block's presentation on his method

Installation

The preferable way is to add the repository through the Resources -> Updates -> Manage Repositories...
Add the following URL: https://pixinsight-updates.astroswell.com/
This way you'll receive all the updates automatically

Manually script can be downloaded on the Releases page (download StarDe-emphasizer.zip)

Method

The method consists of the following steps:
  1. Get starful image's luminance
  2. Apply MultiscaleLinearTransform to it in order to extract structures(stars) of a certain size
  3. Apply Binarize process to that
  4. Apply MorphologicalTransformation(Dilation) in order to make binarized stars uniform and round
  5. Apply Convolution to smooth dilated stars' edges
  6. Subtract the luminance image from the convolved image. This way we get a halos mask
  7. Apply the starless image to the starful image through the halos mask
  8. Enjoy the result or adjust the parameters and retry :)
Usage

The interface of the script allows you to see how each stage of the process modifies the image.

Script's Interface
  1. Choose the target image and its corresponding starless image
  2. Select a preview area on the main preview image by clicking the mouse and scrolling to zoom in.
  3. Press the "Process Preview" button
  4. You can press the mouse on the "Result" area to compare the result with the original
  5. Adjust parameters and press "Process Preview" again to see the changes in some of the stages previews and the resulting image
  6. When you're ready, press the "Apply" button to start the process on the target image
  7. Close the script
Source files


Suggestions and improvements

If you have any suggestions or feedback on how to improve this script please open an issue in this repository or this forum thread 😉
 
Last edited:

freed

Well-known member
Mar 6, 2017
107
5
Hello, tried on MAC OS but having a hard time modifying the preview area. Is there a way to reset it. Thanks
 

freed

Well-known member
Mar 6, 2017
107
5
To give you more info, the preview takes full height and 2/3 width. I can move it with some difficulty left to right but nothing else.
 

astroswell

Member
Dec 20, 2020
24
6
To give you more info, the preview takes full height and 2/3 width. I can move it with some difficulty left to right but nothing else.
Have you tried to scroll the mouse wheel or on the track pad? The area should get smaller and then you can click to move the square. I've been developing on Mac as well and seemed to work fine
 

bvalente

Well-known member
Feb 17, 2017
66
0
I was able to get it working just fine. the middle wheel was intuitive and easy to zoom and move the preview window

my biggest issue is the preview window(s) aren't big enough for me to see well enough to make adjustments to the parameters. I zoomed in to just a couple stars but i still couldn't see enough detail. It also could partly be from me using a 4k monitor.

thanks for this script!

Brian
 

astroswell

Member
Dec 20, 2020
24
6
On my Mac book pro I have only a track pad and no success.
weird... do you scroll with the two-fingers gesture? in the browser for example?

I was able to get it working just fine. the middle wheel was intuitive and easy to zoom and move the preview window

my biggest issue is the preview window(s) aren't big enough for me to see well enough to make adjustments to the parameters. I zoomed in to just a couple stars but i still couldn't see enough detail. It also could partly be from me using a 4k monitor.

thanks for this script!

Brian
Thanks for the feedback! I'm still figuring out how all the controls should be organized and what is the preferable workflow for a user... Would be nice if you can share the screenshot of a whole area just to have an idea how much real estate are there. I'll work on making the script resizable
 

freed

Well-known member
Mar 6, 2017
107
5
My bad. I was trying single finger na d right click. Dual fingers works fine - there is a small delay but nor real issue. Very nice script. Thanks
 

camastro

Member
Mar 13, 2019
13
1
Works well - I like that the UI gives visibility of the intermediate steps so that you're not having to adjust parameters blindly to achieve the result you want.

Good job!

Gordon
 

astroswell

Member
Dec 20, 2020
24
6
Works well - I like that the UI gives visibility of the intermediate steps so that you're not having to adjust parameters blindly to achieve the result you want.

Good job!

Gordon
thanks!

By the way, I've added a new, preferable way to install the script,
which is to add the repository through the Resources -> Updates -> Manage Repositories...
Add the following URL: https://pixinsight-updates.astroswell.com/
This way you'll receive all the updates automatically.
 
  • Like
Reactions: rbotero

astroswell

Member
Dec 20, 2020
24
6
Hi there, today I've release a new, improved version.

1. Redesigned interface, so it's now resizable and gives more space for the stages previews
2. Now it's possible to switch between stages. Also, you can hold the right mouse button on the image to compare with the previous stage
3. Added readout date at the right bottom corner
4. On the Structure preview you can click the pixel and its K value will be set as a binarization threshold

screenshot.jpg
 
  • Like
Reactions: enzodb

ngc1535

PixInsight Ambassador
Feb 1, 2014
831
159
AdamBlockStudios.com
Astrowell (Maxim),

I am VERY late to the party. I apologize.... First let me say it is highest compliment to take my innovation/ideas and make it a script.
I could not be happier! I have been observing with the UKIRT telescope (Mauna Kea) and haven't had a chance to play with it- much less even thank you for creating it.

I will do this over the next few days. I obviously can see exactly what you are doing (being quite familiar with the method :)) and it looks incredible.

With regard to the large stars- if there isn't an easy way within the script- then creating this image and simply creating the right kind of star mask exterior to the script seems easy enough.

I will write back again.
Sincerely,
Adam Block
 
  • Like
Reactions: astroswell

ngc1535

PixInsight Ambassador
Feb 1, 2014
831
159
AdamBlockStudios.com
Maxim,

Quick follow-up... it works! Awesome.
The key is to construct the right kind of halo mask by means of the intermediate steps...
This is great.

With regards to the large stars- the trick would be to add another "step" or feature. I don't know how hard it would be. But you would specify a Mophological Transformation of closing (on the binarized mask) of a particular size to isolate the large stars and this would be subtracted from the binarized mask to remove those stars from the mask so they would not be touched. The one little hitch is that the resulting large stars that MT with closing returns... generally needs to be dilated a little to make certain during subtraction they completely remove the detected large stars. This dilation could probably be hardcoded. But...as I mentioned above- a mask that someone already knows how to make to protect the large stars would work as well.

With your permission...I would like to make a tutorial on the use of your script.

Please let me know!
Sincerely,
Adam
 

astroswell

Member
Dec 20, 2020
24
6
Hi Adam, thanks for the response!
But you would specify a Mophological Transformation of closing (on the binarized mask) of a particular size to isolate the large stars and this would be subtracted from the binarized mask to remove those stars from the mask so they would not be touched.
I will try to implement a closing stage one of these days, should be pretty straight forward

With your permission...I would like to make a tutorial on the use of your script.
Of course! That would be great. Let me then first finish the closing part and then maybe some other issues come up to solve, so it's safe to recommend that script to other people :)
 

niccoc1603

Well-known member
Mar 23, 2019
52
2
why don't you think about using Starnet++ to create the Structure mask?
 
Last edited:

astroswell

Member
Dec 20, 2020
24
6
why don't you think about using Starnet++ to create the Structure mask?
I'd say that starnet++ is overkill for that, it's super slow. But it's possible to make as an option to choose already generated one. The benefit of it is that starnet mask won't contain any object parts like galaxy or nebulosity. The downside is possibly not very accurate stars with artifacts. It happens often with the starnet.
But thanks for the suggestion! I think I might collect more feedback to understand which way to go in the next versions
 

astroswell

Member
Dec 20, 2020
24
6
I am patiently waiting to do a tutorial on this! :) :)
I probably should have notified that I've added a closing part, so if you think it's working now as it should that feel free to do a tutorial or give a feedback ;)
For example one thing I've struggled with is working with the M42, starnet removes the stars in such a way that leaves darker spots on their former places, and then when it's projected through the halo mask, it creates dark rings around the stars. Maybe it's a specific issues with this target or if the starless image is generated using your method of filling the holes with a matching noise it will be better than the starnet generated one.
 

freed

Well-known member
Mar 6, 2017
107
5
My bad. I was trying single finger na d right click. Dual fingers works fine - there is a small delay but nor real issue. Very nice script. Thanks
For some odd reason on MAC OS, I'm having a hard time again with changing the preview. Are you clicking and moving two fingers, just moving two fingers, something else ? I'm tried many combinations but no success.