Colour tools

Masked saturation and hue shifts, narrowband palettes (SHO, HOO, HSO, Foraxx), LRGB combination, dual-band extraction.

Version
1.0.0
Licence
MIT
Author
Erwan Sturzenegger
astrostack
≥ 0.1.0
Downloads
0
Size
14.6 KB

Description

Targeted saturation and hue adjustments, narrowband palettes (SHO, HOO, HSO, Foraxx), LRGB combination and Hα / OIII extraction from a colour sensor with a dual-band filter.

What it does

The plugin provides four post-processing stages (pipeline:) for astrostack (the CelestiaX application).

  • saturation: increases (or decreases) saturation through a luminance mask: the weight is 1 between low and high and smoothly falls to 0 below (sky background) and above (bright cores), with transitions of width soft. The gain 1 + amount × weight multiplies the a*/b* chrominance in CIELab (default, preserves brightness), or the saturation in HSV / HSL. The hue_shift rules then move selected hues on the HSV wheel (0 red, 120 green, 240 blue): triangular weight around the from hue, over ± range degrees, towards the to hue; weakly saturated pixels (neutral background) are left alone.
  • narrowband: builds an RGB image from separately stacked Hα, OIII and SII channels. Backgrounds are equalised (median removed, common pedestal) and, with normalize, OIII and SII are brought to the scale of the Hα signal (99.5th percentile above background). Each channel is weighted (weights), optionally auto-stretched (stretch_inputs), then the palette is built:
    • SHO (Hubble palette): R = SII, G = Hα, B = OIII;
    • HSO: R = Hα, G = SII, B = OIII;
    • HOO: R = Hα, G = B = OIII;
    • Foraxx: Paulo Foraxx's dynamic palette, which blends Hα and OIII (and SII) pixel by pixel according to their intensity, for more natural gold / blue tones. With ha_to_red, the stage does something else: it adds the Hα excess (Hα scaled to the red channel, minus the red, floored at 0) to the red channel of an RGB image, weighted by amount.
  • lrgb: replaces the luminance of a colour image with a deeper L channel, in CIELab. L is first matched (median and highlights) to the luminance of the RGB image (match), then blended (l_weight); the a*/b* chrominance can be boosted (saturation).
  • dualband: splits a colour image taken with a dual-band filter (L-eXtreme, L-eNhance, ALP-T…) into Hα = R and OIII = weighted mean of G and B. Both channels are written to ctx.channels (usable afterwards by narrowband) and the image becomes an HOO palette, the Hα channel alone, the OIII channel alone, or stays unchanged.

The ctx.channels channels

narrowband and lrgb read channels stacked per filter. To get them, set input: {group_by: filter} in the core configuration: astrostack stacks each filter read from the FITS FILTER keyword separately, on a common alignment reference, and stores the result in ctx.channels ({filter name: image}). Names are normalised: Ha, H, HALPHA → Ha; O3, OIII → OIII; S2, SII → SII; L, LUM → L; R, G, B. A channel with a different size is resized (Lanczos) with a warning. dualband creates the Ha and OIII channels itself from a colour image.

Why / when to use it

  • Vespera, Seestar, colour sensor: saturation after stretching to bring a nebula to life without colouring the background noise or saturating the stars; hue_shift to fix a colour cast (orange drifting to red, cyan to blue).
  • Colour sensor + dual-band filter (Seestar with its built-in LP filter, Vespera with a dual-band filter): dualband for an HOO image, or to extract Hα and OIII and then apply narrowband in Foraxx.
  • Mono SHO data (filter wheel with Hα / OIII / SII): narrowband with group_by: filter. Classic SHO palette, HOO for OIII-rich nebulae, Foraxx for a softer rendering.
  • Hα on an RGB image (galaxy with HII regions, faint nebula): narrowband with ha_to_red.
  • Mono LRGB: lrgb combines a long luminance with shorter colour layers (possibly binned).
  • When not to use it: saturation on a still-linear image (colours are invisible there, the luminance mask makes no sense); narrowband / lrgb without group_by: filter (no channels: the stage is skipped); dualband on an image taken without a dual-band filter (the red channel is then not Hα).
  • Recommended position: dualband, narrowband and lrgb after crop and background, on the linear stack (except Foraxx, with stretch_inputs: true) and before stretch; saturation on the stretched image.

Installation

astrostack plugin install color-tools

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

Parameters

saturation

Name Type Default Description
amount float (−1 to 3) 0.4 Saturation gain (0 = none, negative = desaturate)
low float (0–1) 0.1 Luminance below which nothing is saturated (background)
high float (0–1) 0.9 Luminance above which nothing is saturated (cores)
soft float (0.001–0.5) 0.08 Width of the luminance mask transitions
space choice (lab, hsv, hsl) lab Colour space used for saturation
hue_shift text (YAML), optional empty Hue rules: [{from: 0-360, to: 0-360, range: degrees, amount}]
mask text, optional empty Post-processing mask (see below)

In hue_shift, range defaults to 30 and amount to 1; a single rule can be given without brackets.

narrowband

Name Type Default Description
palette choice (SHO, HOO, HSO, Foraxx) SHO Palette (SHO and HSO need SII; Foraxx: dynamic)
weights 3 floats [1.0, 1.0, 1.0] Hα, OIII, SII weights
equalize bool true Equalise channel backgrounds
normalize bool true Bring OIII / SII to the scale of the Hα signal
stretch_inputs bool false Stretch each channel before combining (automatic)
target_background float (0.02–0.5) 0.15 Target background of the channel stretch
ha_to_red text, optional empty Add Hα to the red of an RGB image, e.g. {amount: 0.5} (or a plain number)

lrgb

Name Type Default Description
l_weight float (0–1) 1.0 Share of L in the final luminance
saturation float (0–3) 1.0 Chrominance factor (a*, b*)
match bool true Match L to the RGB luminance before replacing it

dualband

Name Type Default Description
oiii_weights 2 floats [0.5, 0.5] G and B weights for OIII
output choice (HOO, ha, oiii, keep) HOO Output image
equalize bool true Equalise backgrounds (HOO)
normalize bool true Bring OIII to the scale of Hα (HOO)

The mask parameter

saturation accepts the astrostack core masks. The mask (0 to 1) is computed on the image before the stage and the result is before × (1 − m) + after × m. Short form or YAML dictionary: mask: "stars invert" (do not saturate the stars), mask: "object feather=8" (nebula only), mask: "color hue=[180,260]" (blues only). Types: luminance, color, stars, object, range, file, combine; common options invert, blur, strength.

YAML examples

Vespera nebula: saturation outside the stars, oranges pulled towards red:

pipeline:
  - stretch: {}
  - saturation:
      amount: 0.6
      mask: "stars invert"
      hue_shift: [{from: 30, to: 0, range: 20, amount: 0.7}]

Mono SHO data stacked per filter, Hubble palette:

input: {lights: "lights/*.fits", group_by: filter}
pipeline:
  # … masters, quality, register, stack, crop, background …
  - narrowband: {palette: SHO, weights: [1.0, 1.2, 0.9]}
  - stretch: {}

Colour sensor + dual-band filter, Foraxx rendering:

pipeline:
  - dualband: {output: keep}
  - narrowband: {palette: Foraxx, stretch_inputs: true, target_background: 0.15}

Outputs

  • saturation, lrgb: modify ctx.image (NaN borders are preserved by saturation).
  • narrowband: ctx.image becomes the RGB palette image (negative values clipped to 0). With stretch_inputs, if the image has not been stretched yet, ctx.linear receives the linear version of the palette. With ha_to_red, only the red channel of ctx.image is modified.
  • dualband: writes ctx.channels["Ha"] and ctx.channels["OIII"], then replaces ctx.image according to output.
  • No file is written; each stage prints a summary in the console. Stages lacking the required data (monochrome image for saturation, missing channels for narrowband / lrgb, non-colour image for dualband) are skipped with a warning.

Limitations

  • dualband assumes an ideal split: the red channel also contains SII and continuum, and G/B mix Hα and OIII depending on the sensor response; it is not a true spectral separation.
  • Without SII, narrowband replaces SHO / HSO with HOO. Hα and OIII are mandatory.
  • hue_shift works in HSV and ignores weakly saturated pixels; a cast on the grey background is better fixed with the core color stage.
  • lrgb assumes L and RGB are aligned (same alignment reference, which group_by: filter provides).

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 4 steps to the pipeline.

StepTypeRole
saturation Saturation & huesPost-processingLuminance-masked saturation; selective hue shifts.
narrowband Narrowband palettePost-processingSHO / HOO / HSO / Foraxx from the Hα, OIII, SII channels; or Hα into red.
lrgb LRGB combinationPost-processingL luminance combined with RGB colour (CIELab).
dualband Dual-band extractionPost-processingHα = R, OIII = (G+B)/2 from a colour sensor with a dual-band filter.
  • Post-processing On the stacked image, replayable in the live preview.

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)