Banding correction

Removes horizontal and vertical CMOS banding frame by frame, before debayering.

Category
Calibration
Version
1.0.0
Licence
MIT
Author
Erwan Sturzenegger
astrostack
≥ 0.1.0
Downloads
0
Size
7.9 KB

Description

Removes horizontal and vertical CMOS banding frame by frame, before debayering.

What it does

The plugin provides one per-frame operation, banding, to be placed in the frame_ops: list of astrostack (the CelestiaX application). frame_ops run on every frame, in the worker processes, before registration and stacking.

Principle: in a frame, banding shows up as a small level offset shared by a whole sensor row (or column). The operation estimates this offset from the sky background and subtracts it.

  1. Per CFA colour: on a raw colour frame (a single plane with a Bayer matrix), each of the four sub-planes (R, G1, G2, B) is processed separately, so that the colours of the Bayer pattern are not mixed up. On a mono or already debayered image, each channel is processed separately.
  2. Star masking: the median and noise (MAD) of the plane are estimated; pixels above background + star_sigma × σ (stars, galaxies, bright nebula) are masked, with the mask dilated by 5 × 5 px. Invalid pixels (NaN) are ignored as well.
  3. Robust profile: for each row (rows) or column (cols), the median of the remaining background pixels gives a profile. A fully masked row receives the overall median.
  4. Scale filtering: only variations finer than scale rows/columns are corrected. The profile is compared with a version smoothed by a median filter of width scale; slow variations (light-pollution gradient, vignetting) are therefore kept and left to the core background stage. With scale: 0, the whole profile minus its median is removed.
  5. Correction: the profile, multiplied by strength, is subtracted. With axis: both, rows are corrected first, then columns.

Why / when to use it

  • CMOS sensors with visible banding: many CMOS sensors (astro cameras, DSLRs/mirrorless, smart telescopes) show thin horizontal bands, especially at high gain and with short exposures. They are not random from frame to frame and often survive stacking.
  • Without darks or bias (Vespera, Seestar, smart-telescope frames): the readout pattern cannot be subtracted by calibration; banding removes it directly on each frame.
  • Banding revealed by a strong stretch: faint nebula backgrounds, long integrations where random noise has dropped and the fixed pattern stands out.
  • When not to use it: if your darks/bias already remove the pattern, or if no band is visible on the stretched stack; on a field where the object fills almost the whole image (little background to estimate the profile); with a too small scale on thin straight structures (nebula edges aligned with the rows).
  • Recommended position: after calibrate and cosmetic, before debayer. Working per CFA sub-plane only makes sense on the raw frame.

Installation

astrostack plugin install banding

Or from the Plugins view of the CelestiaX application. No extra Python dependency (python_deps is empty): the plugin uses NumPy, SciPy and OpenCV, already required by the astrostack core.

Parameters

banding (frame_op)

Name Type Default Description
axis choice (rows, cols, both) rows Banding direction: horizontal rows, vertical columns or both
strength float (0–1) 1.0 Fraction of the correction applied
star_sigma float (1–10) 3.0 Star/object masking threshold (σ above background)
scale int (0–1024) 64 Largest corrected scale (rows/columns); 0 = no filtering

Tips: lower star_sigma (2 to 2.5) if diffuse nebulosity biases the correction; lower scale (16 to 32) to touch only very thin bands; raise it (256 or more) if the bands are wide. This operation has no mask parameter (post-processing masks only apply to pipeline: stages).

YAML examples

Raw colour frame with horizontal banding (the most common case):

frame_ops:
  - calibrate
  - cosmetic: {auto: true}
  - banding: {axis: rows}
  - debayer: {method: bilinear}

Smart telescope without darks, horizontal and vertical bands, slightly softened correction:

frame_ops:
  - cosmetic: {auto: true}
  - banding: {axis: both, strength: 0.8, scale: 32}
  - debayer: {method: rcd}

Diffuse nebula filling the field: more aggressive masking and correction at all scales:

frame_ops:
  - calibrate
  - banding: {axis: rows, star_sigma: 2.0, scale: 0}
  - debayer

Outputs

  • Each frame is replaced by its corrected version (float32, NaN preserved), before the next frame_ops operations.
  • No file is written and no state key is added: the correction is only visible in the processed frames and then in the stack.

Limitations

  • Only banding aligned with the sensor rows or columns is corrected; oblique or wavy patterns and interference fringes are not.
  • The profile is estimated on the background: a row almost entirely covered by a bright object is poorly estimated (it receives the overall median).
  • With scale: 0, slow gradients along the axis are removed too, which can flatten an extended nebula.
  • Banding that is weak compared with the noise of a single frame is hard to measure: the effect will then be limited, stacking already averaging out part of the pattern if it varies from frame to frame.

Licences

  • Plugin: MIT licence, © Erwan Sturzenegger.
  • Dependencies (provided by the core): NumPy and SciPy (BSD), OpenCV (Apache 2.0), SEP (LGPL / BSD).

Steps provided

This plugin adds one step to the pipeline.

StepTypeRole
banding CMOS bandingPer frameRemoves horizontal/vertical sensor bands (before debayering).
  • Per frame Applied to every raw frame before stacking (frame_op).

Dependencies

No dependency beyond CelestiaX: the plugin works as soon as it is installed.

Versions

  1. 1.0.0 current

    Initial release (extracted from the astrostack core)