Removing the stars from your image can be done for artistic purposes or to separate the nebulosity from the star field so it can be processes differently. Removing the stars is highly dependent on a good star mask. There’s a couple tricks to getting an accurate star mask. The first is using MultiscaleMedianTransform to kill the larger structure sizes. If your image is in color already, I normally extract the lightness data from it (see Figure 1) to use as a support image for creating the star mask. I typically rename this image star_mask_support.
Next, I bring up MultiscaleMedianTransform and make sure it’s reset to the default settings. Then I disable the residual layer (see Figure 2) and and set the Target to Lightness (CIE L*). You may have to change the layers (while keeping the residual layer disabled) depending on your star sizes. For the data I’m working with, 4 layers worked quite well. There will typically be a little nebulosity or galaxy structure left after running this. I use the clone stamp tool to remove the the non-stellar stuff before creating a star mask.
The second trick is to make several star masks to catch the different star sizes (see Figure 3). This part takes a lot of fiddling. I don’t touch much in the Mask Preprocessing section except the Midtones. For the Mask Generation section I typically leave all options off and vary the Smoothness based on the star sizes I’m trying to re-create (if the start to look square, I up the value some). The other parameters just take experimentation.
Now that you have several different star masks we need to combine them. I like to use PixelMath to do this. Some people use addition but I think that throws things off when you have the same star represented in multiple scale levels, so instead I use the max function (see Figure 4). This way the brightest elements of all three star masks will be combined into on mask. I typically apply this to the image called star_mask and then close the others.
Now that we have an accurate star mask we can start removing stars. Apply your star mask to your image (leave it non-inverted) and then bring up the MorphologicalTransformation tool (see Figure 5). We are going to use the erosion mode which will shrink the stars, pinching in the surrounding data as the star reduces in size. Apply MT to your image and you’ll see the stars get smaller and fainter. Once the stars are almost non existent I switch back to MMT to smooth out the result a little (see Figure 6). Basically invert the layers you had disabled when creating the star_support image, so if you were using 4 layers before with the residual disabled switch that so the first four layers are disabled and the residual is enabled (if your image is in color remember to switch the target to RGB/K mode). Figure 7 shows a sequence of how the stars were reduced in this image where the first 6 tiles were using MT and the last 2 using MMT.
If you are really having trouble getting an accurate star mask, then there’s one other trick you can try. It requires that you plate solve your image and use that as a reference for the CatalogStarGenerator script. I only use this as a last resort because the catalogs frequently do not include all the star in the field. But if you simply can’t separate the stars from the nebulosity in your image this technique might help.
I hope this is useful!