PDA

View Full Version here: : using PixelMath to get rid of magenta stars in SHO/Hubble palette narrowband


troypiggo
05-08-2014, 10:47 PM
Update: See post #8 (http://www.iceinspace.com.au/forum/showpost.php?p=1107210&postcount=8)below. I've tweaked the formula specifically for magenta now, and updated the zip file with process icon below. Just download the zip file, unzip somewhere safe and memorable (My Documents/PixInsight or something like that). In PixInsight, choose "Load process icons" and browse to that xpsm file you unzipped. The magenta_reduction PixelMath process icon should appear on the PI desktop, and you can just drag and drop that on your image.

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

-----------------------
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.

pluto
05-08-2014, 11:17 PM
That's really interesting Troy.
I've tried a similar technique in Lightroom with mixed success.
I've also played with this in Photoshop but I find Lightrooms approach more intuitive.

I think it worked well in this SHO Carina nebula:
http://hughsblog.wordpress.com/2014/04/21/ngc3372-in-hubble-palette/
But then the couple of images I did after this looked weird and seemed to look better with magenta stars, like this M16:
http://hughsblog.wordpress.com/2014/07/31/m16-eagle-nebula-in-hubble-palette/

RickS
06-08-2014, 07:30 AM
Nice technique, Troy.

I've done something similar using the CIE a and b channels to select areas of magenta (and other colours). I find the results are a bit more consistent using a/b rather than RGB values because you're working purely with the colour component.

Of course, the easy way to desaturate magenta halos in PI is with the ColorSaturation process...

Cheers,
Rick.

troypiggo
06-08-2014, 09:05 AM
Thanks guys.

Rick - I'd be interested to see your CIE a and b solution. I'm not as familiar with that colour space.

The reason I like this solution is that there's no star masking needed, so you can't get dark halos. It just detects magenta (defined by a red to blue ratio of 0.9 say) as well as the mean of red and blue being greater than the green. There could be some colour shifts in nebulosity as well as stars in rare instances where this rule is matched, but with SHO palette the green would be close to the mean of red/blue so increasing the green a little is not that noticeable in the test images I tried.

RickS
06-08-2014, 09:20 AM
I'll post an example tonight. I usually build them on the fly.

RickS
07-08-2014, 06:39 PM
Troy,

I tried your process icon on my M17 data and it did a good job on the stars but had trouble with the bright nebulosity (maybe I should have killed the CIEL() subexpr). See attached before and after images. Still a very cool demonstration of the power of PixelMath!

Here's a quick & dirty expression that creates a magenta mask that works for my M17: "CIEa($T)>0.62&&CIEb($T)<0.59".

Mostly I use the ColorSaturation process to kill my magenta fringes. Another great tool is ColorRange from Carlos Milovic. It allows you to define a range of colours in a selectable colour space (RGB, CIELAB, etc.) and then builds a mask that selects those colours in an image.

Cheers,
Rick.

troypiggo
07-08-2014, 09:31 PM
Cheers mate. I'll have a play tomorrow. Think you're right about the CIEL not being needed. I had another idea tonight to improve that I want to try too.

Haven't seen that colour selection tool. Will look into that too.

troypiggo
09-08-2014, 10:53 AM
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.

RickS
09-08-2014, 09:05 PM
Not bad, Troy. See before and after examples...

troypiggo
09-08-2014, 09:23 PM
That looks like the result I had in mind :)

RobF
09-08-2014, 09:55 PM
Impressive stuff Troy. Way beyond my feeble understandings of PM. Thanks for the insights guys.

peter_4059
10-08-2014, 08:15 AM
Looks good Troy.

ozstronomer
10-08-2014, 12:44 PM
Troy

Nice work with Pixmath, I ran it over a wide field of The Craw taken through the Megrez 72mm doublet which showed some violet fringing and it made a difference to the overall star colour, stars now appear whiter.


Many thanks

Geoff