Hoping for someone to explain some Pixelmath

3 replies82 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
Erik Westermann avatar

$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
Help figuring out exposure times from dark sites
I’ve never quite figured out a way to decide on exposure times. None of the tutorials or tricks ever seemed to quite work for me. Now that I understand it a lot better, I realize it’s because the details of my acquisition are quite a bit different th...
Aug 14, 2024
Both posts describe astronomy enthusiasts seeking to understand technical processes they can observe working but lack comprehension of the underlying details or decision-making principles.
Interference-Style LP (Maybe even enhancement) filters, Fast Short Optics and the Problem with Long Period Variable Stars! Lesson Learned?
The following is something that I just posted with my last image, since it is relevant to the data generated and processed. I am partially reposting here, and changing where appropriate to those who may not see my image Rosette West Widefield - In OS...
Feb 18, 2024
Both posts are incomplete, ending abruptly with partial website URLs.