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

Offline jkmorse

  • PixInsight Padawan
  • ****
  • Posts: 895
  • Two questions, Mitch . .
    • View Profile
    • Jim Morse Astronomy
Nice add!
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 Salvatore Giambruno

  • Newcomer
  • Posts: 29
    • View Profile
Works great!  Thanks!
--Sal

Offline gnomus

  • Newcomer
  • Posts: 13
    • View Profile
Silly question time.  Do you apply the Pixel Match formula to the whole image or to one that has been star-masked?

Offline troypiggo

  • PixInsight Addict
  • ***
  • Posts: 252
    • View Profile
Not a silly question at all.  PixelMath works on a pixel by pixel basis, and this expression just converts every pixel that is magenta to gray.  So if the only magenta in your image is halos around stars, you can apply to whole image.  But if, for some reason, there's magenta in other parts of your image (like nebulosity) that you may want to keep that colour in, you'd be best to use a star mask so it only applies to the magenta around the stars.

Offline jlmanatee

  • Newcomer
  • Posts: 6
    • View Profile
I'm just beginning to try to understand PixelMath expressions, so please forgive my ignorance. 
Pertaining to this expression:

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

I understand this to be saying: 
1.  Assuming for an SHO combination, $T[0] = SII, $T[1] = Ha and $T[2] = OIII
2.  The first argument is comparing the lower of the minimum pixel sample values of SII and OIII to Ha's minimum pixel sample value. The result is either a 1 or a 0.
3.  The inline IF statement is saying If the first argument is 1, then G is set to either SII or OIII, which ever has a smaller minimum pixel sample value.
4.  However, it the first argument is 0, then G is set to Ha.

If this is correct, there seems to be a possibility that my PixelMath combination will completely ignore my Ha image.
Or am I reading this all wrong?

Incidently, I used this PixelMath expression in my last effort and was highly pleased with the elimination of my purple stars.  So I must be mis-interpreting how the expression is evaluated.  Help!
« Last Edit: 2017 October 11 15:41:57 by jlmanatee »

Offline oldwexi

  • PixInsight Guru
  • ****
  • Posts: 534
    • View Profile
    • Astronomy Pages G.W.
Hi jlmanatee!
Its simple. Magenta is visible when green is to low.
Therefore Ha is used for the green part to increase green when there is magenta.

Or,  Magenta is produced out of red and blue.
when the lowest value in the actual pixel of the red and blue channel is
higher than the Ha (green) then the pixel is magenta and should be increased
by the higher Ha value...

Gerald

Offline jlmanatee

  • Newcomer
  • Posts: 6
    • View Profile
I must be pretty thick.  Yes, I understand that magenta is produced out of red and blue.  What I don't understand is the PixelMath formula.  If I read it correctly (I doubt myself) the G channel formula's outcome will just be Ha, SII or OIII and not some combination like .2*OIII + .8*Ha or whatever.  As an example if I run the numbers with one of my own set of subframes, Ha would be completely ignored because the minimum pixel sample value of my OIII is smaller than my Ha or SII.  If this were true, my PixelMath would evaluate to being an SOO, not an SHO.  But, like I say, this can't be right.  Here's my end result in this particular case. (with all modesty, my best work to date - be kind)
http://cdn.astrobin.com/images/solutions/84ec7986-d799-42d9-8794-37b3f98a180b-1507338624.png

Offline pfile

  • PTeam Member
  • PixInsight Jedi Council Member
  • *******
  • Posts: 3315
    • View Profile
what you are saying is true; the pixelmath may evaluate to SOO... but what you are missing is that because of all the conditionals, only the magenta colored pixels are converted to SOO. when all the conditions fail, G (which is T[1]) is assigned to T[1], so everywhere where the pixels do not look magenta, the images is still SHO.

rob

Offline jlmanatee

  • Newcomer
  • Posts: 6
    • View Profile
Ah, the light bulb is starting to glow.  Dimly. Thanks Pfile.
What's really happening (I think) is a pixel-by-pixel determination.  That's why they call it PixelMath - Duh.  T[0], T[1] and T[2] are decided upon "per pixel" and not as a whole channel necessarily.  Mind Blown.  More wrapping my head around this to come. 
« Last Edit: 2017 October 13 00:27:36 by jlmanatee »

Offline pfile

  • PTeam Member
  • PixInsight Jedi Council Member
  • *******
  • Posts: 3315
    • View Profile
yes absolutely, the pixelmath expression is evaluated at every single pixel in the source image(s). you can even use the position of the pixel as one of the inputs to a conditional expression to gain further control over what happens. for instance if you wrote iif(x() > 100, 0, $T), you'd end up with an image that has a 100 pixel-wide vertical strip of pixels from the original image, and the rest of the image black.

rob

Offline troypiggo

  • PixInsight Addict
  • ***
  • Posts: 252
    • View Profile
Ah, the light bulb is starting to glow.  Dimly. Thanks Pfile.
What's really happening (I think) is a pixel-by-pixel determination.  That's why they call it PixelMath - Duh.  T[0], T[1] and T[3] are decided upon "per pixel" and not as a whole channel necessarily.  Mind Blown.  More wrapping my head around this to come.

Yes, you've got it.  Pixel by pixel.  Looks like you were thinking the whole image in each channel was getting adjusted, but it's just each pixel.

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

The expression looks at each pixel.  If the G isn't strong enough, the pixel is magenta=R+B, boost it to the min of R and B.  Keep in mind the intent of this expression is for use with SHO images, where the nebulosity and background are typically greens/yellows/browns, and the magenta is usually just a halo around the stars.  So the expression has no effect on the nebulosity, just the magenta around the stars - no need for star masks etc.  The effect of increasing the G value to that of R or B in magenta areas is basically to desaturate it, as all 3 channels end up becoming very close values.

It is a sledgehammer approach.  So if you use it on a standard RGB image instead of SHO, and there's magenta elsewhere in nebulosity (maybe M42 for example?), it will desaturate the nebulosity, too.  So in those instances, maybe a star mask would be wise.  Only reason I can think of where you'd be doing this, though, might be for magenta/green chromatic abberations around bright stars, for example.