Automatic (Dynamic) Background Extraction — ADBE

Models the sky background — gradients, vignetting, light pollution — with a polynomial plus an optional radial-basis refinement, and removes it while preserving star colour and linear photometry. Non-destructive: nothing changes until Apply.

1. Using the tool

Set the model parameters, optionally guide the sampling (exclude regions or place points by hand), Preview, then Apply. The preview is fully interactive; the sampling behaviour depends on whether you're in Auto or Manual mode.

For RGB data, combine R/G/B into one colour image before running ADBE. Running it on separate mono channels can leave colour artefacts at saturated stars once they're recombined.

Model parameters

ControlWhat it does
Polynomial degree (0–6)Order of the smooth large-scale background surface. Higher fits more structure but risks absorbing real signal. 0 skips the polynomial entirely → RBF-only (and enables RBF automatically).
# sample pointsHow many background samples the automatic sampler places (Auto mode only — disabled in Manual).
Downsample factor (4–32)The background is fit on a shrunk copy for speed. Keep it ≥ 4; factor 1 with RBF on can exhaust memory.
Patch size (px)The window whose median is taken at each sample point — larger is more robust to noise and faint stars.
Sample modeAuto (ADBE chooses points) or Manual (you place them on the preview).
Random seedMakes the auto sampling reproducible; -1 = different every run.
RBF refinement + Smooth (×0.01)Enable a second multiquadric stage that models residual, irregular gradients the polynomial can't; Smooth sets how loosely it fits (higher = gentler).
Correction modeSubtract (standard additive removal) or Divide (for vignetting / multiplicative gradients).
Create background documentAlso open the extracted gradient as its own image.
Preview background instead of correctedShow the model itself rather than the result.

Sample points: Auto vs Manual

This is the key choice, and it changes what your mouse does in the preview:

Auto mode — drawing exclusion areas

Exclusion areas are regions where no sample points will be placed — draw them around bright nebulosity, a large galaxy, or anything that isn't sky background, so the gradient fit isn't contaminated.

Manual mode — placing points by hand

In Manual mode you drop sample points exactly where you want the background measured:

Three helpers seed a starting set and switch you to Manual so you can refine by hand:

Navigating the preview

Running it

Preview computes the correction without touching the document; Apply commits an “ABE” step (and, if asked, the background document); Close dismisses. The grip (bottom-left) drags to the canvas to mint an ADBE shortcut with these settings, or drops on an image to apply headlessly.

2. Technical details

A two-stage background model is fit on a downsampled copy, in a stretched domain for sampling accuracy, then un-stretched and removed in linear space so photometry and star colour survive.

2.1 Two-stage background model

The smooth component is a 2-D polynomial of the chosen degree d, least-squares-fit to the sampled background values z:

B(x,y)=\sum_{p+q\leq d} c_{pq}\,x^{p}\,y^{q}\,,\qquad \min_{c}\;\|A\,c-z\|^{2}

If RBF refinement is on, a second surface is fit to what the polynomial left behind, using a multiquadric radial basis over the sample points:

\phi(r)=\sqrt{r^{2}+\epsilon^{2}}\,,\qquad B_{\mathrm{rbf}}(x)=\sum_i w_i\,\phi\!\left(\|x-x_i\|\right)

The RBF stage is capped at ~1 megapixel (downsampling further if needed) to bound memory, and its smoothing scales with the sample count so the control feels consistent regardless of how many points there are. The total model is B = B_poly + B_rbf.

2.2 Smart sample placement

In Auto mode the sampler seeds points at the corners, along the borders, and within each image quartile, then refines each one by gradient descent to the dimmest nearby spot — it repeatedly steps to whichever neighbour has the lowest local patch-median luminance, so samples land on background rather than on stars or nebulosity:

Y=0.2989\,R+0.5870\,G+0.1140\,B

Within each quartile the brightest ~50% of pixels are excluded before random selection (bright-region avoidance), and any user exclusion polygons remove their pixels from the candidate pool. At every chosen point the background value is the median of the surrounding patch, which rejects stars and hot pixels.

2.3 Fit stretched, remove linear

Gradients are easiest to sample on stretched data, but must be removed from linear data to keep photometry intact. ADBE does both: it fits the model on an auto-stretched copy, then un-stretches the background model back to linear and removes it from the original linear image. The fitting stretch is the same analytic midtones transfer used by Statistical Stretch (target median 0.25):

S(x)=\frac{(M-1)\,T\,x}{M\,(T+x-1)-T\,x}\qquad(T=0.25)

This “fit in stretched space, subtract in linear space” order is what preserves star colour and linear flux relationships — subtracting a stretched background directly would distort both.

2.4 Correction & rescale

With the linear background model B, the two correction modes are:

\mathrm{subtract:}\quad \mathrm{out}=I-B+\left(\mathrm{med}(I)-\mathrm{med}(I-B)\right)
\mathrm{divide:}\quad \mathrm{out}=\frac{I}{B/\mathrm{med}(B)}\ \ (\text{re-centred on }\mathrm{med}(I))

Both re-centre the result on the original median so overall brightness is preserved. A final clip-free, median-anchored rescale lifts any negatives and compresses the ceiling only if the data exceeds 1.0 — holding the median fixed — so no values are hard-clipped away.

2.5 Masking & notes