using PixelMath to get rid of magenta stars in SHO/Hubble palette narrowband

troypiggo

Well-known member
Update to the below:

There are some images and colour combinations that did show odd results.  Check out my post further down this thread.

Now I'm using the following formulae, just boosting G to the min of R and B.  See the link above for effects on a colour wheel showing how it much better targets just the magenta.

R: $T[0]
G: iif(min($T[0],$T[2])>$T[1],min($T[0],$T[2]),$T[1])
B: $T[2]

The attached zip file has been updated to use this formula.

---------------------------------------------

Original post:

Not sure if this has been done before, but I had this idea recently on how to get rid of the magenta stars in SHO narrowband images due to the red SII and blue OIII channels needing to be stretched so much to balance strong G Ha.  A common Photoshop method I've seen is to do a selection based on colour (magenta), and desaturate it.

It occurred to me that with PixelMath we may be able to achieve something like this.  We could detect if a pixel is magenta by checking if it's R and B channels were of similar value (within some acceptable range), and if they both were significantly brighter than the G channel.

With this in mind, I came up with the following formulae.  I found some stars needed a luminance  rule in there too.

R: $T[0]
G: iif((CIEL($T)>MIN_BRIGHTNESS)||((min($T[0],$T[2])/(max($T[0],$T[2])>MAGENTA_DEFN))&&(mean($T[0],$T[2])>$T[1])),mean($T[0],$T[2]),$T[1])
B: $T[2]
Symbols: MAGENTA_DEFN = 0.9, MIN_BRIGHTNESS = 0.9

Attached are some sample before and after images (not my images, but have sought the approval of the image owners where possible.  Some were from a Google image search).  Seems to work ok to me.  Thoughts?  Any improvements or suggestions on the above?

I'm just hoping it is a quick and simple solution to what seems to be a common issue with narrowband images.  Just drag and drop the attached process icon on your final narrowband image with magenta stars and they're gone.
 

Attachments

  • Eta before after.jpg
    Eta before after.jpg
    134.2 KB · Views: 507
  • NGC7822 before after.jpg
    NGC7822 before after.jpg
    145.5 KB · Views: 427
  • Bob Frank before after.jpg
    Bob Frank before after.jpg
    68 KB · Views: 398
  • Magenta_Star_Reduction.zip
    890 bytes · Views: 462
I am just beginning to collect narrowband data and I will add this to my list of threads. Nice work.
 
Troy,

Nicely done!  Will try this out on some of my old NB images at let you know how it works.

Best,

Jim
 
really nice work! i think this was the last piece of the puzzle for my for PI NB processing.

rob
 
Replacing G with Mean(R, B) will boost the pixel's luminance. This maybe OK or not. If not, all components could be scaled down. The scale factor would be something like the CIEL luminance ratio cubed (or cube-rooted?) so to appropriately linearize the ratio.

Mike
 
Mike,

For us who are NOT pixelmath experts, could you go into a little more detail on how you would apply your proposed fix?

Thanks!

Jim
 
Troy,

I hope you don't mind but I am going to include this in the next version of my cribsheet.  This is too good to pass up.

Thanks again!

Jim
 
mschuster said:
Replacing G with Mean(R, B) will boost the pixel's luminance. This maybe OK or not. If not, all components could be scaled down. The scale factor would be something like the CIEL luminance ratio cubed (or cube-rooted?) so to appropriately linearize the ratio.

True.  I've been experimenting with that to try to keep the input and output luminances the same, but nothing got the consistent results that the above formula did.  I'll keep trying to come up with something.

Don't suppose you know the relationship between the individual channel values and the lum?  It's not additive as I'd expect.

jkmorse said:
For us who are NOT pixelmath experts, could you go into a little more detail on how you would apply your proposed fix?

I'll go back and edit the first post with more explanation when I get a chance.

jkmorse said:
Troy,

I hope you don't mind but I am going to include this in the next version of my cribsheet.  This is too good to pass up.

Thanks again!

No worries at all.
 
jkmorse said:
For us who are NOT pixelmath experts, could you go into a little more detail on how you would apply your proposed fix?
Jim

Jim,
Actually my suggestion probably won't work. Preserving luminance, as I was thinking, might not make sense, since input luminance itself might be too high due to the RB bloat. Not sure what to do.
Mike

 
Mike,

Thanks anyway.  As an old liberal arts major (and I do mean old), you guys who can do the math fascinate me.

Best,

Jim
 
Troy, et al., Cool! It might also be useful to expand SCNR's capabilities to include Magenta and Cyan. Most cases, we'd still want to use a star mask, but we'd be able to target magenta stars that way. Of course, we do have both ColorSaturation and Curves/Saturation enabling us to reduce or alter a specific range as well.
 
G'day Warren. Not sure what you mean about SCNR?

What I liked about the PixelMath solution is that no star masks are needed at all, so no risk of halos. You just drag n drop the process icon on you full, unmasked image.
 
OK, stupid question time,

I am trying to access the process Troy provided in the zip folder but don't know where to put it to get it working  :-[

Can somebody just remind me where to access the unzipped file from.

Sorry for the early onset dementia,

Jim
 
You can put the file in the zip anywhere , as long as you remember where. :) in PI, right click and choose "load process icon" and navigate to the file. A process icon called " magenta_ star_reduction " should appear. Just drag n drop that on your image. Double click to see the actual PM window with formulae etc.
 
Ok. Greatly simplified the formulae, and it targets the magenta specifically which is great. Will work best on images before you do any colour shifting to get the teals and golds, as it relies on the relationship between R and B. It simply boosts the G value to the minimum of R and B.

R: $T[0]
G: iif(min($T[0],$T[2])>$T[1],min($T[0],$T[2]),$T[1])
B: $T[2]

Images below show it's effect on a colour wheel. Note the previous versions of the formula affected much more of the colour wheel.
 

Attachments

  • Clipboard01.jpg
    Clipboard01.jpg
    138.7 KB · Views: 156
  • Clipboard02.jpg
    Clipboard02.jpg
    137.5 KB · Views: 135
  • Clipboard03.jpg
    Clipboard03.jpg
    127.9 KB · Views: 119
Back
Top