An excellent method of blending RGB stars with a narrowband image [Deep Sky] Processing techniques · Shannon Foye · ... · 60 · 7065 · 48

Shannon_Foye 8.73
...
· 
·  29 likes
I’ve tried many of the suggested methods of adding RGB star color to a narrowband image. Most of these methods produced unsatisfactory results and/or artifacts that were difficult to fix. My attempts at blending RGB and Narrowband have been limited to the use of PixInsight.

I was introduced to the PixelMath screen blending technique in one of Adam Block’s Horizons tutorials. This method uses the expression of “combine( RGB, Narrowband, op_screen())” in PixelMath to blend a RGB image with a starless narrowband image. 

This screen blending method is by far the best technique I’ve found for adding RGB stars to a narrowband image but it is not perfect. Some noise and artifacts are added to the narrowband image. Applying the luminance of the narrowband image (the narrowband image prior to star removal) to the blended image helps with the noise and fixes most of the star artifacts. However, it still could not correct a noticeable artifact created in the halo of a large star.

In trying to find a way to fix the artifact in the large star, I stumbled across a nearly perfect, artifact-free method of blending RGB stars to a narrowband image. The key is simply to apply the luminance of the extracted narrowband stars only image (using StarXTerminator with the Unscreen Stars box checked) to the RGB image before screen blending it with the starless narrowband image.

The following are the basic steps that I used to add RGB star color to a narrowband image without adding noise or artifacts to the narrowband image:

1. Apply StarXTerminator to the narrowband image with the Unscreen Stars box checked.
2. Extract the luminance of the narrowband stars only image.
3. Apply the luminance of the narrowband stars only image to the RGB image.
4. Screen blend the RGB image with the starless narrowband image. Screen blending can be done by either “combine( RGB, Narrowband, op_screen())” or “~((~Narrowband)*(~RGB)).” 

I used this approach of blending RGB stars with a narrowband image here: https://astrob.in/9zozi9/0/

The two images below show the RGB image next to the screen blended RGB/narrowband image.

RGB and Narrow:RGB.jpg

RGB and Narrowband:RGB 2.jpg
Like
CRKessler 7.43
...
· 
·  2 likes
This looks like the answer to all my prayers regarding this massive hurdle in my processing abilities!  I'll give this a shot once I get a new set of data collected. Thank you for sharing this!
Like
gnnyman 4.52
...
· 
Sounds interesting, but what do you mean with 3.?  What do you do at that point..?

Thanks and CS,
Georg
Like
DalePenkala 15.85
...
· 
·  1 like
I’ll have to give this a try Shannon. I do pretty much the same process you have described except not doing this NB Stars Lum layer. Thanks for posting this.

Dale
Like
Shannon_Foye 8.73
...
· 
·  6 likes
Georg N. Nyman:
Sounds interesting, but what do you mean with 3.?  What do you do at that point..?

Thanks and CS,
Georg

I use ChannelCombination to apply the extracted luminance of the narrowband stars only image to the RGB. In this screenshot, this luminance image is "Narrowband_stars_L." 

The luminance of the StarXTerminator narrowband stars only image can be created with the "Extract CIE L*component" shortcut on the toolbar or the ChannelExtraction process.
Step 3.jpg
Like
jonnybravo0311 7.83
...
· 
·  8 likes
James Lamb just recently did a video on YouTube describing a method of combining RGB stars with a narrowband image. The basic combination is very similar pixel math. The interesting twist he uses is to add a cosine curve. Here's the pixel math for the red channel:
Rn = pixel($T,x(),y(),0);
Gn = pixel($T,x(),y(),1);
Bn = pixel($T,x(),y(),2);
Ln = max(Rn, Gn, Bn, 0.001);
Rs = pixel(Stars,x(),y(),0);
Gs = pixel(Stars,x(),y(),1);
Bs = pixel(Stars,x(),y(),2);
Ls = max(Rs, Gs, Bs, 0.001);
L = ~((~Ls)*(~Ln));
L*(Rn/Ln + 0.5*(Rs/Ls-Rn/Ln)*(~cos(pi()*Ls)))
You repeat that for each channel, modifying the last line to be Gn/Ln... Gs/Ls-... for green and Bn/Ln...Bs/Ls... for blue. That last multiplier (~cos(pi()*Ls)) helps to better preserve the star colors.

If you haven't yet watched his videos, he's got a lot of great, really deep dives into topics. You can view the video that produces the pixel math above right here: https://www.youtube.com/watch?v=hX3LKhwqwvY
Edited ...
Like
Shannon_Foye 8.73
...
· 
Here's the pixel math for the red channel


It's interesting to see complex PixelMath expressions like this in use.
Like
CWTauri 6.72
...
· 
·  13 likes
First unscreen the (RGB) stars between an original (stretched image) and its starless version by using ~(~original/~starless) .
Then, blend these (RGB) stars into NB data with combine(NBimage,unscreened_stars,op_screen())  . 
The unscreened stars will not have a background (and if there is one, you can make it zero by raising the black point a little. 
THere will be very few artifacts since the unscreened stars image has no background.

-adam
Like
a.erkaslan 4.88
...
· 
·  1 like
Thanks for sharing ! I need to give it a try.
CS,
Aygen
Like
Shannon_Foye 8.73
...
· 
·  2 likes
Adam Block:
blend these (RGB) stars into NB data with combine(NBimage,unscreened_stars,op_screen())


Adam,

With an image that has intricate narrowband structures, StarXTerminator will pick up some of the fine, bright structures as stars and remove them with the stars. I experienced this with my Crescent Nebula image. Without applying the luminance of the unscreened narrowband stars to the RGB image, these fine narrowband structures will be lost.

Also, some of the small narrowband stars that are removed may not be present in the RGB image. This may happen when the RGB image consists of just an hour or two of data and the narrowband data consists of dozens of hours. These small stars will be also be lost if the luminance of the unscreened narrowband stars is not applied to the RGB stars before screen blending it with the starless narrowband image.

Artifacts may appear where these small stars and small narrowband structures are not restored to the narrowband/RGB blended image.

To remedy this problem, I tried applying the luminance of the original narrowband image (prior to star removal) to the final narrowband/RGB screen blended image. This corrected the vast majority of the tiny artifacts. I still had one remaining large artifact in the halo of the a largest star in the middle of the Crescent Nebula.

That one remaining large artifact bothered me, and so I tried applying the luminance of the screened narrowband stars to the RGB image before screen blending it with the starless narrowband image. To my eye, the result was perfect. All small stars and intricate narrowband structures were returned to the narrowband image.

When I blinked the before and after narrowband images, the only difference that I could see down to the level of individual pixels was that the star colors had changed from HOO to RGB. The nebula details were perfectly identical between the two images. The luminance of the two images were identical because I had applied the luminance of the unscreened narrowband stars to the RGB image before screen blending the RBG image with the starless narrowband image.

This specific workflow only worked for me with the Crescent nebula because I did not alter the narrowband image after removing the stars. I had 50 hours of narrowband data. The Ha and Oiii combined beautifully with no need to manipulate the starless image before screen blending the RGB stars into in.
Edited ...
Like
CWTauri 6.72
...
· 
·  2 likes
Russ has a new version (new training) that might address some of the artifacts you were dealing with. I have been beta testing it. 
-adam
Like
Shannon_Foye 8.73
...
· 
·  1 like
Adam Block:
Russ has a new version (new training) that might address some of the artifacts you were dealing with. I have been beta testing it. 
-Adam

I tried the new version. I saw a slight improvement in the one large star that gave me problems. The problem of small stars and structures removed in the narrowband image not being replaced by the RGB image was still present.

As a side note, I used the original RGB image instead of the screened stars to blend with the narrowband starless image. I stretched the image enough to bring out the stars. Most of the nebula that was brought out in the stretch was subsequently removed when the luminance of the narrowband screened stars was applied to the RGB image. The luminance levels of any remaining nebula pixels in the RGB image were much lower than the corresponding pixels in the starless narrowband  image, and therefore didn't create noise or artifacts in the blended image.
Like
gnnyman 4.52
...
· 
·  1 like
I have tried it and yes it works, but - with the expression in PM combine.... it works better because if I apply the described enhanced formula, the stars are getting the tint of the background from the starless image
grafik.png
Left is the result with the "combine" algorithm and right that with the longer enhancing formula in PM. I have no explanation for this because I do not understand why and what happened. The starless image and the stars look like that:
grafik.png
And that is the formula, I used - of course with the appropriate changes for G and B...

grafik.png
Can someone please explain to me, what and why that might have happened?  If necessary, I am happy to provide both files... (each one is about 38MB - too large just to upload it here...)
Thanks and CS
Georg
Edited ...
Like
paddy36 1.51
...
· 
Hi all

Very interesting when using Pi but how do do that with Astroart or Startools etc...
Thanks and CS

Patrick
Like
Starman609 6.45
...
· 
·  1 like
Also don't forget to add in the following expression under Symbols:

Rn;
Gn;
Bn;
Ln;
Rs;
Gs;
Bs;
Ls;
L;
Edited ...
Like
dweinbrenner 2.11
...
· 
·  2 likes
Interesting approach with the cosine function.
I just tried it but found it to be not as good as the bare screening.
Like
gnnyman 4.52
...
· 
Also don't forget to add in the following expression under Symbols:

Rn;
Gn;
Bn;
Ln;
Rs;
Gs;
Bs;
Ls;
L;

Those are in "symbols".... , however thanks for that hint!
Like
gnnyman 4.52
...
· 
·  1 like
Dominik Weinbrenner:
Interesting approach with the cosine function.
I just tried it but found it to be not as good as the bare screening.

Me too - that´s why I posted my concern and results.... "combine...." is better - at least up to now for me...
Like
Shannon_Foye 8.73
...
· 
·  1 like
Below is a screenshot comparing the results of the cosine, straight screen, and screen but with the luminance of the narrowband unscreened stars applied to the unscreened RGB stars.

To be clear, I am applying the luminance of the extracted narrowband unscreened stars  to the RGB (stars or original) image before screen blending it with the starless narrowband image. I have tried applying the luminance to both the original RGB and the unscreened RGB stars. The results are equivalent unless you examine the image at a scale of 6:1, and even at that large of a scale the differences are trivial.

The star below is in the middle of the Crescent Nebula. The ringing artifact around this one star is what led me to trying the narrowband star luminance modification to the screen blending method.

The Screen image and the luminance/screen image below appear identical except for the ringing artifact . However, when I put one image on top of the other and blink the images, it becomes apparent that there are faint small stars and fine, bright narrowband structures missing from the screened image.

These small stars and narrowband structures were removed from the narrowband image during star removal. They do not show up or exist in the RGB image. When the starless narrowband and RGB stars images are screen blended, these small stars and narrowband structures are lost. These fine details can be recovered if the luminance of the extracted narrowband stars (small structures included) is applied to the RGB image before screen blending.

Cosine - Srcreen - Screen with L applied to RGB copy.jpg
Edited ...
Like
Shannon_Foye 8.73
...
· 
·  1 like
The image on the left is the narrowband before applying StarXTerminator  (with the box for unscreened stars checked). The middle and right images show the results of applying the luminance of the extracted, unscreened narrowband stars to the RGB unscreened stars and alternatively, to the original RGB image. I found no meaningful difference between the two images.

Please note that I did not alter the starless narrowband image before screen blending the RGB stars in to it.

HOO - Screen with L applied to RGB.jpg
Like
Shannon_Foye 8.73
...
· 
·  1 like
Georg N. Nyman:
Can someone please explain to me, what and why that might have happened?


Georg,

Look at the second to last line in your cosine PixelMath expression. The following is a direct copy and paste from the video description from James Lamb's tutorial:

Rn = pixel($T,x(),y(),0);
Gn = pixel($T,x(),y(),1);
Bn = pixel($T,x(),y(),2);
Ln = max(Rn, Gn, Bn, 0.001);
s = pixel(Stars,x(),y(),0);
Gs = pixel(Stars,x(),y(),1);
Bs = pixel(Stars,x(),y(),2);
Ls = max(Rs, Gs, Bs, 0.001);
L = 1-(1-Ls)*(1-Ln);
L*(Rn/Ln + 0.5*(Rs/Ls-Rn/Ln)*(1-cos(pi()*Ls)))

Your second to last line is different.

Also, James Lamb has updated the video description with a shorted version of his expression. It is a single RGB/K expression:

Ln = max($T[0], $T[1], $T[2], 0.001);
Ls = max(Stars[0], Stars[1], Stars[2], 0.001);
L = 1-(1-Ls)*(1-Ln);
F = (1-cos(pi()*Ls))/2;
L*( (1-F)*$T/Ln + F*Stars/Ls )

Symbols:

F;
Ln;
Ls;
L;
Edited ...
Like
jonnybravo0311 7.83
...
· 
·  1 like
Shannon Foye:
L = 1-(1-Ls)*(1-Ln);
L*(Rn/Ln + 0.5*(Rs/Ls-Rn/Ln)*(1-cos(pi()*Ls)))

Your second to last line is different.


They are the same. Using the expression ~x is identical to 1-x. Thus, the last two lines of the expression can be written as:
L = ~((~Ls)*(~Ln));
L*(Rn/Ln + 0.5*(Rs/Ls-Rn/Ln)*(~cos(pi()*Ls)))


I explained the same in a comment on James' video.
Shannon Foye:
Also, James Lamb has updated the video description with a shorted version of his expression. It is a single RGB/K expression:

Ln = max($T[0], $T[1], $T[2], 0.001);
Ls = max(Stars[0], Stars[1], Stars[2], 0.001);
L = 1-(1-Ls)*(1-Ln);
F = (1-cos(pi()*Ls))/2;
L*( (1-F)*$T/Ln + F*Stars/Ls )


I hadn't seen his update... that's quite simplified. Thanks!
Like
gnnyman 4.52
...
· 
Shannon Foye:
Georg N. Nyman:
Can someone please explain to me, what and why that might have happened?


Georg,

Look at the second to last line in your cosine PixelMath expression. The following is a direct copy and paste from the video description from James Lamb's tutorial:

Rn = pixel($T,x(),y(),0);
Gn = pixel($T,x(),y(),1);
Bn = pixel($T,x(),y(),2);
Ln = max(Rn, Gn, Bn, 0.001);
s = pixel(Stars,x(),y(),0);
Gs = pixel(Stars,x(),y(),1);
Bs = pixel(Stars,x(),y(),2);
Ls = max(Rs, Gs, Bs, 0.001);
L = 1-(1-Ls)*(1-Ln);
L*(Rn/Ln + 0.5*(Rs/Ls-Rn/Ln)*(1-cos(pi()*Ls)))

Your second to last line is different.

Also, James Lamb has updated the video description with a shorted version of his expression. It is a single RGB/K expression:

Ln = max($T[0], $T[1], $T[2], 0.001);
Ls = max(Stars[0], Stars[1], Stars[2], 0.001);
L = 1-(1-Ls)*(1-Ln);
F = (1-cos(pi()*Ls))/2;
L*( (1-F)*$T/Ln + F*Stars/Ls )

Symbols:

F;
Ln;
Ls;
L;


Yes, I know that the second to last line is different, but mathematically it is identically - as Jonny Braco stated already. But all does not explain, why I get parts of the background color into the stars desite using that expression - with both versions - the R.G.B and the RGB/K version. That is what I do not understand.
I assume, that the dark background color of the nebula part is still mixed with the star color - but why if the cosinus should prevent this from doing?
Edited ...
Like
gnnyman 4.52
...
· 
·  1 like
Hello again,

I played around with various methods and algorithms, which are presented in that string of feedbacks....strange results, I must say, which I got:

First set of two screenshots: Left a crop of the stars as extracted with StarXterminator inside PI - in the area of the red/blue M27 nebula, all stars are heavily colored in the color of the nebula, but in the RGB image of the nebula, they are almost white - see right screenshot
2022_09_11_10_29_451.jpg
If I extract the stars in PS with the same algorithm and subtract the nebula with stars from the starless image, I get stars which are less and dfferently colored and better usable  - left the stary only out of PI extraction and right the stars out of PS with subtraction method

2022_09_11_10_31_492.jpg
Now it is getting even stranger for me - I combine the stars with the described algorithm in PI - all stars inside the nebula are colored with the color from the RGB image and therefore unusable
Whereas on the right side you see the stars coming from the PS subtraction - not good at all, but certainly a bit better and their color less disturbing

2022_09_11_10_34_413.jpg

However, when I use the well known method of screen blending with PM, I get the best results... see yourself

2022_09_11_10_35_384.jpg

I have no explanation for this and I cannot understand it either ..... for me, the combine(1,2,op_screen()) works best..

Maybe someone of you can enlighten me.. ?
Edited ...
Like
Shannon_Foye 8.73
...
· 
·  2 likes
Jonny Bravo:
Thus, the last two lines of the expression can be written as:

Thank you Jonny. I could not PixelMath my way out of a wet paper bag.
Edited ...
Like
 
Register or login to create to post a reply.