Jump to content
  • Pixel Math for New Users


    Reggie Jones

    I've searched for references on Pixel Math in PixInsight for a long time to improve my skills with this tool.  I ran across a forum post on the PI Forum from Fred Vanner who's provided one of the best responses to this question that I've seen.  Apparently, no such specific reference exists, but Fred offered some tips to get a basic understanding how to use Pixel Math.  I've posted his information verbatim below as it is quite useful.

    • While experimenting, I recommend always select "create new image".
    • As far as I know, PM must always be applied to a "target" image (either using the "apply" square icon or the "apply instance" triangle icon) I have not yet found a context in which the "apply global" icon makes sense. Even if the target image data is not going to be used, the image will be used to set the (x,y) dimensions of the processing.
    • For each pixel (i.e. each x, y coordinate pair), the specified PM expression is evaluated and assigned to the image output. For a monochrome image, a single PM expression is used; for an RGB image, a different expression can be assigned to each colour channel, or the same expression can be used for all channels [in this case the expression is effectively a vector expression - but this is usually entirely intuitive].
    • The symbol $T is defined to be the target image pixel value (i.e. the PI image data value, as a normalised [0 - 1] floating number or RGB triplet).
    • For an RGB image, the symbols $T[0], $T[1], $T[2] return the R, G and B channel values; if the image has an alpha layer it is represented by $T[3].
    • PM can also reference other loaded views by name. The use of a view name in an expression evaluates to the data in that view at the current (x,y) position. The channel selectors (e.g. [0] for R) can be applied to a named view.
    • Example 1: the PM expression "$T*0.5" applied with "use a single RGB/K expression" selected will output an image with all the pixel values halved.
    • Example 2: the expression "(image1+image2)/2" will output an image with each pixel the average of the two specified images provided PM is applied to an image with the same dimensions as image1 and image2 (for example, PM could be applied to image1 or image2).
    • In the "syntax" menu of the "expression editor" you will find a commented list of functions, operators and other expression syntax elements.
    • It is possible to have conditional expressions, for example: "iif($T<0.5, 0, 1)" will binarise the image with a threshold of 0.5.
    • some useful functions:
      • x(), y(): the current pixel coordinates
      • h(), w(); the height and width of the image
      • max(), min(), mean(), med()... applied to an image (e.g. min($T), med(image1)) return the corresponding image statistic
    • You can achieve many tasks using just the above information. You may find it usefull to find out more about symbols and symbol asignment.

    Separate from this, another PI user provided the link below to a presentation on Pixel Math that is also quite helpful.

    http://trappedphotons.com/files/Presentations/Advanced PixInsight PixelMath Operations.pdf


    User Feedback

    Recommended Comments

    There are no comments to display.


×
×
  • Create New...

Important Information

By using this site you agree to our Guidelines