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

troypiggo

• Posts: 252
using PixelMath to get rid of magenta stars in SHO/Hubble palette narrowband
« on: 2014 August 05 12:43:37 »
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 »

NGC7789

• PixInsight Old Hand
• Posts: 391
Re: using PixelMath to get rid of magenta stars in SHO/Hubble palette narrowband
« Reply #1 on: 2014 August 05 13:11:51 »
I am just beginning to collect narrowband data and I will add this to my list of threads. Nice work.

jkmorse

• Posts: 900
• Two questions, Mitch . .
Re: using PixelMath to get rid of magenta stars in SHO/Hubble palette narrowband
« Reply #2 on: 2014 August 05 14:10:43 »
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

oldwexi

• PixInsight Guru
• Posts: 541
Re: using PixelMath to get rid of magenta stars in SHO/Hubble palette narrowband
« Reply #3 on: 2014 August 05 14:40:48 »
Troy!
Very nice idea and PixelMath Expression!

Gerald

pfile

• PTeam Member
• PixInsight Jedi Council Member
• Posts: 3408
Re: using PixelMath to get rid of magenta stars in SHO/Hubble palette narrowband
« Reply #4 on: 2014 August 05 17:01:16 »
really nice work! i think this was the last piece of the puzzle for my for PI NB processing.

rob

mschuster

• PTeam Member
• Posts: 973
Re: using PixelMath to get rid of magenta stars in SHO/Hubble palette narrowband
« Reply #5 on: 2014 August 05 18:05:54 »
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

jkmorse

• Posts: 900
• Two questions, Mitch . .
Re: using PixelMath to get rid of magenta stars in SHO/Hubble palette narrowband
« Reply #6 on: 2014 August 05 19:52:21 »
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

jkmorse

• Posts: 900
• Two questions, Mitch . .
Re: using PixelMath to get rid of magenta stars in SHO/Hubble palette narrowband
« Reply #7 on: 2014 August 05 19:57:57 »
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

Juan Conejero

• PTeam Member
• PixInsight Jedi Grand Master
• Posts: 6050
Re: using PixelMath to get rid of magenta stars in SHO/Hubble palette narrowband
« Reply #8 on: 2014 August 05 20:19:52 »
Hi Troy,

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

troypiggo

• Posts: 252
Re: using PixelMath to get rid of magenta stars in SHO/Hubble palette narrowband
« Reply #9 on: 2014 August 05 21:21:55 »
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.

mschuster

• PTeam Member
• Posts: 973
Re: using PixelMath to get rid of magenta stars in SHO/Hubble palette narrowband
« Reply #10 on: 2014 August 05 21:31:21 »
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

jkmorse

• Posts: 900
• Two questions, Mitch . .
Re: using PixelMath to get rid of magenta stars in SHO/Hubble palette narrowband
« Reply #11 on: 2014 August 05 21:54:55 »
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

Warhen

• PixInsight Old Hand
• Posts: 400
Re: using PixelMath to get rid of magenta stars in SHO/Hubble palette narrowband
« Reply #12 on: 2014 August 06 14:51:32 »
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

troypiggo

• Posts: 252
Re: using PixelMath to get rid of magenta stars in SHO/Hubble palette narrowband
« Reply #13 on: 2014 August 06 19:30:15 »
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.

jkmorse

• Posts: 900
• Two questions, Mitch . .
Re: using PixelMath to get rid of magenta stars in SHO/Hubble palette narrowband
« Reply #14 on: 2014 August 06 19:48:11 »
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