Hoping for someone to explain some Pixelmath

3 replies86 views
Quinn Groessl avatar

Looking for some pixel math help. Mostly to just understand what I’m doing. I see what it does, and I understand the process as a whole, but just don’t know what each expression is doing. For reference I’m getting these from this website: https://www.nightphotons.com/guides/advanced-narrowband-combination/ specifically the method 1. I’ve had success doing this, but I would really like to understand more about what the pixelmath is doing because I’m pretty sure it’s not just magic.

The first expression: $T[0] - ($T[1] - med( $T[1]))

This is their last step in continuum subtraction. $T is target image I think? other than that I’m not sure.

Second is when adding the data, the expression is: $T * ~x + x * mtf(~m, (mtf(m, $T) + mtf(m, NB)))

In the above, x is the color channel, so R, G, or B. and then in the symbols part of Pixelmath it has: R = 1.0, G = 0.0, B = 0.05, m = 0.999,

What I gather from that is the number value after the R, G, or B is a percentage (I think), but what does the m value do?

Engaging
andrea tasselli avatar
You can get a pretty good idea of what does what by looking into PixelMath contextual definitions.

$T is the target image, med is a function that returns the median value of $T. So the first string returns the first image minus the difference of the second once its median value has been subtracted. (EDIT: by second is meant the second channel [G] in a RGB, with the first being the R).

As for the second if you are asking what mtf(m,x) is and does, it is the Midtones Transfer Function and the m is its strength parameter (from 0 to 1) and x is the image operand. The mtf can be thought as a basic non-linear stretching as obtained by using auto-stretching in PI. You can see that m needs not to be 1 in order for the whole expression to make sense.
Helpful
[deleted]

$T[0] is your image’s red channel, [1] is green and [2] is blue.

Quinn Groessl avatar

Perfect. Thanks both of you. It’s making more sense to me now.

Well Written Respectful
Related discussions
Noob in Deep Sky Dreaming of Galaxies
Hi fellow astrophotographers! I've been mainly doing planetary photography, however deep sky, and specifically galaxies interest me a lot. I tried looking into acquisition and processing - however it turned out to be way more confusing than I cou...
Pixelmath is a processing tool relevant to galaxy image post-processing workflows.
Oct 23, 2023
My SH2-171
Somethings off here… really struggled to balance the colors after adding Ha and Lum data… I would appreciate any and all criticism I dont think its a BAD image… just somethings off… https://www.astrobin.com/5l783v/
Pixel math help for understanding Ha and Lum data processing techniques.
Oct 30, 2023
Problems with blue stars when adding Ha to LRGB.
Hi! I would greatly appreciate your help. When I'm processing my LRGB_Ha image without stars, and then I want to add stars, I see that the blue stars change color slightly; they turn violet with a red center. This only happens when the Ha is added to...
Explains PixelMath fundamentals to understand color channel manipulation formulas.
Jan 9, 2026
Combining RGB and Luminance in Siril 1.2.0
Hi dear AstroBinners Quick question How do I combine RGB and Luminance? I know how to combine L R G B, where in color composing you upload L R G B and then it comes together. However in that case you strech everything at once, and I would want to str...
Pixelmath can be used to combine RGB and luminance channels separately.
Dec 29, 2023