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. 

 NOTE:

In PART 2 many clever viewers have noticed at around the 11 minute mark I make a copy/paste error. I was supposed to paste the expression and change the "width" to "height". Since I was working with equal values there was no harm. The correct expression is below and I think the intent of the exercise is clear... even though I goofed.

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.)

 PART ONE

PART TWO