YAGEx
Remove sky background gradients without taking away the faint nebulosity that cost you hours of exposure.
Work in progress
Overview
A perfect sky would be uniform. In practice every image carries a veil that varies from edge to edge: the city lights one corner of the field, the Moon another, the optics darken the corners. Removing it looks simple, except that a large diffuse nebula looks a lot like a gradient. Too aggressive a tool erases it along with the veil, and the result looks clean precisely because your signal is gone.
YAGEx attacks that trade-off by aiming at a weakness the current tools share: they reject their background samples against a global statistic that is itself distorted by the very gradient being removed. So YAGEx looks for the real sky rather than for the dark areas. It examines the texture of each region, because pure sky has a recognisable statistical signature whether it is bright or dark: a background area on the lit side of the gradient is recognised as background, and faint nebulosity, however dark, does not pass itself off as sky.
It then fits its model to the bottom of the distribution, where only the sky lives, since everything that shines merely adds light. Rather than asking you to guess a degree or a smoothing factor, it puts a range of models into competition, from the rigid plane to supple surfaces, and uses cross-validation to keep the one that best predicts the background where it was not fitted. And when the nebula fills the field and the sky survives only on a fringe, it knows: below a certain support, only the most rigid models compete, because an honest tool knows when it does not know.
All of this is measured, not asserted. The reference bench starts from real images with no gradient, injects a known one, and requires the tool to restore the original: across thirteen masters and four gradient shapes, fifty-two scenes in all, YAGEx comes first on forty-one, and first on all thirteen masters by mean departure from the truth. The noise added by the correction is nil, between -1.0% and +0.1%. The remaining losses are the linear ramps, where the rival's model is exactly the truth by construction.
Subtraction for light pollution, division for vignetting, 32-bit internal computation, optional diagnostic images to see exactly what was removed.
Features
The real sky, not the dark areas
Background classification works on the shape of the pixel distribution, tile by tile, not on its level. It is therefore insensitive to the gradient itself, whereas current tools reject their samples against a global statistic that the very same gradient distorts.
The floor, not the mean
Stars, nebulae and galaxies only ever add light to the sky. The background model is therefore fitted to the bottom of the distribution, where only the sky lives, and samples are pushed down towards the local minima.
A model chosen, not imposed
No degree or smoothing factor to guess. A range of candidates is put into competition, from the rigid plane to polynomials and then supple surfaces, and cross-validation picks the one that best predicts the background where it was not fitted. At equal quality, the most cautious wins.
It knows when it does not know
If the nebula fills the frame and the sky survives only on a fringe, no supple surface can be identified: the one that best hugs the fringe is the one that dives into the nebula and subtracts it. Below 30% support, YAGEx restricts itself to the most rigid models rather than inventing.
Without adding noise
Correcting a gradient should never granulate your sky background. This is measured on every bench scene, not merely hoped for: the noise added by the correction ranges from -1.0% to +0.1%, including on the cleanest skies, where the slightest grain would show.
Subtraction or division
Subtraction for light pollution and moon glow, division for residual vignetting. Internal computation in 32-bit float, optional diagnostic images to see exactly what was removed.
Measured, not asserted
The bench starts from real images with no gradient, injects a known one (ramp, dome, exponential corner, non-monotonic band) and demands the original back. Across 52 scenes from 13 masters, YAGEx comes first on 41, and first on all 13 masters by mean departure from the truth, against ABE and the Siril tools.
A native Process
YAGEx is not a script: it is a module compiled in C++, installed and driven like the processes shipped with PixInsight, real-time preview included. The same engine also powers a command-line tool for your own pipelines. Interface in English or French.
Install
Work in progress
This script is not released yet. Installation will be available once it ships.