Skip to content

Background Neutralization ​

Step: Linear

Makes the sky background neutral gray. In a raw stack the sky often has a color cast: green from airglow, red or orange from city lights, or just an uneven white balance. The module measures how bright the background is in each color channel and shifts the channels so that all three background levels are the same. A tinted sky turns gray, and the color calibration that follows starts from a neutral background.

The module needs a color image. A mono image, or a Bayer mosaic that has not been debayered, is rejected.

Parameters ​

ParameterRangeDefaultEffect
Background limit0…51How far above the typical sky brightness a pixel may lie and still count as background, in units of the sky's noise spread. Lower values measure only the darkest, emptiest sky; higher values include brighter sky and faint nebulosity.
Target levelAverage of channels, Darkest channelAverage of channelsThe level the three backgrounds are moved to. Average of channels keeps the overall background brightness about where it was. Darkest channel lowers the two brighter channels down to the darkest one, which gives the darkest sky; some pixels may fall below zero, which is fine in linear data.

When to use it ​

Use it on the linear image, after stacking and after Gradient Removal, and before color calibration and any stretch. A color cast that is a smooth gradient (for example city light on one side only) should be removed by Gradient Removal first, because this module shifts every pixel of a channel by the same amount and cannot follow a gradient.

If a large nebula fills most of the frame, lower the Background limit so that only the emptiest corners are measured.

How it works ​

  1. Brightness of each pixel. For every pixel with data in all three channels, the brightness is the mean of red, green and blue.

  2. Choosing the background. The module takes the median m and the MAD (median absolute deviation, a robust measure of spread) of that brightness over the whole image. Pixels whose brightness is at most m + limit × 1.4826 × MAD count as background. The median and MAD hardly react to stars and nebulae, which cover only a small part of a typical frame, so these are left out.

  3. Level per channel. The background level of a channel is the median of that channel over the background pixels. All three channels are measured on the same pixels.

  4. Target. The target is the mean of the three levels, or the lowest of them.

  5. Correction. Each channel gets a constant added so that its level reaches the target:

    result = pixel + (target − level of this channel)

The correction is additive. A star keeps exactly the light it has above the background in every channel: star minus background is the same before and after, so the color relation of the stars does not change; only the zero point of each channel moves. A multiplicative correction would change the star colors.

Pixels without a value stay without a value and are ignored when measuring the background. The file information (exposure time, filter and so on) is kept.

This is the clipped-median background estimate that is standard in astronomical image analysis: Bertin & Arnouts, "SExtractor: Software for source extraction", Astronomy & Astrophysics Supplement 117, 393 (1996). Median and MAD as robust measures go back to F. R. Hampel, "The influence curve and its role in robust estimation", Journal of the American Statistical Association 69, 383 (1974). Here the cut is made on brightness so that every channel is measured on the same pixels.

Errors ​

  • Background neutralization needs a color image. The image has one channel. If it is a mosaic from a one-shot-color camera, run Debayer first.
  • The image has no pixels with data in all three channels. There is nothing to measure.