Author Topic: using PixelMath to get rid of magenta stars in SHO/Hubble palette narrowband  (Read 12620 times)

Offline troypiggo

  • PixInsight Addict
  • ***
  • Posts: 249
    • View Profile
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.
« Last Edit: 2014 August 09 01:01:55 by troypiggo »

Online NGC7789

  • PixInsight Old Hand
  • ****
  • Posts: 390
    • View Profile
I am just beginning to collect narrowband data and I will add this to my list of threads. Nice work.

Offline jkmorse

  • PixInsight Padawan
  • ****
  • Posts: 886
  • Two questions, Mitch . .
    • View Profile
    • Jim Morse Astronomy
Troy,

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

Best,

Jim
Really, are clear skies, low wind and no moon that much to ask for? 

New Mexico Skies Observatory
SBIG STXL 6303E w/AOX
Planewave CDK17 - Paramount MEII
Planewave IFR90 - Astrodon LRGB & NB filters
SkyX - MaximDL - ACP

http://www.jimmorse-astronomy.com
http://www.astrobin.com/users/JimMors

Offline oldwexi

  • PixInsight Guru
  • ****
  • Posts: 522
    • View Profile
    • Astronomy Pages G.W.
Troy!
Very nice idea and PixelMath Expression!

Gerald

Offline pfile

  • PTeam Member
  • PixInsight Jedi Council Member
  • *******
  • Posts: 3221
    • View Profile
really nice work! i think this was the last piece of the puzzle for my for PI NB processing.

rob

Offline mschuster

  • PTeam Member
  • PixInsight Padawan
  • ****
  • Posts: 966
    • View Profile
    • http://mschuster.zenfolio.com
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

Offline jkmorse

  • PixInsight Padawan
  • ****
  • Posts: 886
  • Two questions, Mitch . .
    • View Profile
    • Jim Morse Astronomy
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
Really, are clear skies, low wind and no moon that much to ask for? 

New Mexico Skies Observatory
SBIG STXL 6303E w/AOX
Planewave CDK17 - Paramount MEII
Planewave IFR90 - Astrodon LRGB & NB filters
SkyX - MaximDL - ACP

http://www.jimmorse-astronomy.com
http://www.astrobin.com/users/JimMors

Offline jkmorse

  • PixInsight Padawan
  • ****
  • Posts: 886
  • Two questions, Mitch . .
    • View Profile
    • Jim Morse Astronomy
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
Really, are clear skies, low wind and no moon that much to ask for? 

New Mexico Skies Observatory
SBIG STXL 6303E w/AOX
Planewave CDK17 - Paramount MEII
Planewave IFR90 - Astrodon LRGB & NB filters
SkyX - MaximDL - ACP

http://www.jimmorse-astronomy.com
http://www.astrobin.com/users/JimMors

Offline Juan Conejero

  • PTeam Member
  • PixInsight Jedi Grand Master
  • ********
  • Posts: 5960
    • View Profile
    • http://pixinsight.com/
Hi Troy,

Good PixelMath-Fu! :)
Juan Conejero
PixInsight Development Team
http://pixinsight.com/

Offline troypiggo

  • PixInsight Addict
  • ***
  • Posts: 249
    • View Profile
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.

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.

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.

Offline mschuster

  • PTeam Member
  • PixInsight Padawan
  • ****
  • Posts: 966
    • View Profile
    • http://mschuster.zenfolio.com
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


Offline jkmorse

  • PixInsight Padawan
  • ****
  • Posts: 886
  • Two questions, Mitch . .
    • View Profile
    • Jim Morse Astronomy
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
Really, are clear skies, low wind and no moon that much to ask for? 

New Mexico Skies Observatory
SBIG STXL 6303E w/AOX
Planewave CDK17 - Paramount MEII
Planewave IFR90 - Astrodon LRGB & NB filters
SkyX - MaximDL - ACP

http://www.jimmorse-astronomy.com
http://www.astrobin.com/users/JimMors

Offline Warhen

  • PixInsight Old Hand
  • ****
  • Posts: 366
    • View Profile
    • Billions and Billions
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.
Best always, Warren

Warren A. Keller
www.ip4ap.com

Offline troypiggo

  • PixInsight Addict
  • ***
  • Posts: 249
    • View Profile
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.

Offline jkmorse

  • PixInsight Padawan
  • ****
  • Posts: 886
  • Two questions, Mitch . .
    • View Profile
    • Jim Morse Astronomy
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
Really, are clear skies, low wind and no moon that much to ask for? 

New Mexico Skies Observatory
SBIG STXL 6303E w/AOX
Planewave CDK17 - Paramount MEII
Planewave IFR90 - Astrodon LRGB & NB filters
SkyX - MaximDL - ACP

http://www.jimmorse-astronomy.com
http://www.astrobin.com/users/JimMors