Removing Stars from Linear, Unstretched Images
v 1.0 Alex Woronow, Jan. 18, ’20
Here is my version of the work-around for removing stars from linear (unstretched) images. It is based on a video to do the same thing by Edoardo Luca Radice:
https://www.youtube.com/watch?v=GboQWoRovJs&t . Unfortunately, the video is in Italian, but you can play it with “translated” subtitles. Basically, the steps are
Stretch the image using either the HistogramTransform (HT) (perhaps with parameters determined through the ScreenTransferFunction( STF))
Remove the stars from the stretched image
Transform the starless image back to its original linear form
Subtract that reversed-transform from the original image to obtain the unstretched stars
Celebrate, or whatever
Now, the video does not include the fact that the black-point is adjusted by STF, or can be adjusted manually in the HT. So I went back to the HT documentation,
https://pixinsight.com/doc/tools/HistogramTransformation/HistogramTransformation.html and started from the transfer equation given there. It also does not reveal the way to handle the black point, but otherwise is what I needed.
Now HT has three parameters: Shadows (s), Hightlights (h) , and Midtones (m). We need not adjust h, so there is no additional use for it. The value of s is the black-point. Values < s become zero and CANNOT BE RECOVERED from the stretched image. Tread lightly and keep this value fairly low. (Often it is <.005 or so, unless your images have a pedestal.) Usually, for our faint astro-imges, the midtones have a value of around m= .001. (It is actually an rightward offset from s.) Don’t worry about setting these values too well, whatever values we use we will undo them later anyway.
We can manipulate our linear image directly in HT using the preview function and moving the 2 left-most sliders, or by entering values for s and m. Alternatively, we can start with STF. Let’s do that.
Open your linear image in the workspace
If you have already applied a screen stretch to your linear image, REMOVE IT
Open STF and click the yellow & black circle on the left column of tools...this does a temporary screen stretch
Open HT
Back in the STF, at the left bottom is a blue triangle. Grab it and drop it on the bottom icon bar of the HT instance
Remove the STF from the image
Adjust the shadows and midtones values if you like, it should not matter in the end.
Again, remove the STF from the image and apply the HT...Your Image Is now stretched.
Remove the stars using StarTools (inside PI, if you installed it) or use StarTools++ from a command line, in which case you will have to export the stretched image, operate on that exported version, then bringing the starless version back into PI.)
We pause for a moment and look at my PixelMath (PM) icon for removing the stretch on the starless image. (The icon is attached to this article.)
We need two values from HT to enter into the PM icon: s and m, or the value from the Shadows and Midtones boxes in the lower left of the HT window. So, copy and paste over the text now in the icon. You can also change the destination, but DO NOT CHECK THE RESCALE RESULTS BOX!
image attached
We are back with a starless linear image exactly comparable to our star-filled linear image. Therefore we can subtract the former from the latter (PixelMath again) and obtain a linear image containing only the stars. If this image of the stars also contains significant other stuff, something is not right. Try again or contact me through this site. However, remember the value of s could cause some fraction of the darker pixels to be set to zero and become unrecoverable--that’s usually somewhere near the round-off error anyway and not really visible. But if you set s too high, artifacts could become visible.
Hope this works for you!