Pixel Math: Crosshairs Parts 1 and 2

Published 2021/01/02


This lesson uses Pixel Math to construct crosshairs on an image. Don't need crosshairs? That is OK. This section was inspired by a request on the FB "PixInsight for Beginners" group. The exercise of solving this cute problem is a perfect way to demonstrate how the Pixel Math tool works. 


The expression is:  

xc = trunc(width($T)/2);

yc = trunc(height($T)/2);

sz = 100;

iif(inrect(xc-sz/2,yc-sz/2,sz,sz) && (x() == xc || y() == yc),1,$T)

Symbols xc, yc, sz


xc and yc are the variables that are set to equal half the width and height of the image.

sz specifies the size of the crosshairs. 

(It would also be possible to add an offset to put the crosshairs anywhere in the image.)