Masking Facts in PixInsight |
|
|
|
The basic masking procedure works in PixInsight as it commonly does in most imaging applications. Let F and M be two different images. We assume that there exists an active masking relation from M to F, that is, M is acting as a mask for F. Also let P() be a process that can be masked. Then, for each pair of coordinates x, y, if fx,y is a pixel of F and mx,y is the corresponding pixel of M, we have: gx,y = mx,y × P(fx,y) + (1 mx,y) × fx,y where gx,y is the resulting pixel of the processed image G, and pixel values are assumed to be in the normalized range from 0 to 1, where 0 is black and 1 is white. The equation above tells us that the value of each pixel in the mask M works by modulating the process P(). For white mask pixels, the process is fully applied, so the processed pixel value P(fx,y) just replaces the original. For black mask pixels, no process occurs, so the original pixel value fx,y is left unchanged. Finally, for intermediate mask values, the mask pixel value mx,y is the fraction of processed pixel value that will enter the result. Any image can work as a mask in PixInsight. Just that simple. Knowing that masks are essential for virtually any nontrivial image processing in astrophotography, our intention was to implement a masking system as richly featured and flexible as possible. For this purpose, the following rules apply to masks in PixInsight:
Alpha channels are commonly used as transparency masks in many imaging applications, but they cannot be used for this purpose in PixInsight LE 1.0. When an image is working as a mask for another one, modifying the mask does not invalidate the masking relation unless something is changed that makes it no longer possible. For example, you can apply CurvesTransform or SGBNR to a mask, and it will continue working as such without problems, but if you rotate or crop it, for example, this will terminate the masking relation. The following processes can be masked in PixInsight LE 1.0:
Masked processes can be fully used with preview objects in PixInsight. This means that you can preview any maskable process with or without an active mask. When an instance of a maskable process is executed on a view that has an active masking relation, that relation is stored in the process instance, which is appended to the view's processing history. This way, masking relations are preserved throughout the entire life of process instances, including storing them in process set module (.pi-psm) files, applying them to other views, converting them into process icons, etc.
The ProcessContainer process cannot be masked. However, since masking relations are preserved in process instances, including those contained by ProcessContainer, specific masks are appropriately applied when each individual process is executed. This involves quite complex relations between many different objects in PixInsight. |