Standalone color mottle correction tool for astrophotography
Project description
Color Mottle Corrector
color-mottle-corrector is a standalone desktop tool for reducing large-scale background color mottle in stretched OSC astrophotography images.
Color mottle is large-scale unwanted color unevenness in the background of stretched OSC astrophotography images. It usually appears as broad green, red, or magenta color casts and blotches, and sometimes as yellow or blue-yellow background tint. Unlike ordinary fine-grained chroma noise, color mottle affects wider areas of the image and often survives normal denoising, gradient removal, and color calibration.
How It Works
The correction is performed in CIE Lab space.
Only the chroma channels (a and b) are modified. Luminance (L) is left unchanged.
The tool estimates large-scale low-frequency color bias in the background along two chroma axes:
- red / green
- blue / yellow
These correction fields are built from Gaussian-blurred chroma data and recentered so that the algorithm targets relative background color bias rather than absolute image color.
A user-defined soft mask controls where correction is applied:
- protected regions receive little or no correction
- unprotected regions receive the full intended correction
- transition zones are blended smoothly
In the UI mask preview, this is shown as:
- Black: protected region, little or no correction
- White: strongest correction
- Gray: partial correction
The correction is applied as:
a_corr = a - rg_k * RG_field * apply_alpha
b_corr = b - by_k * BY_field * apply_alpha
The final correction pushes local chroma bias toward neutral instead of relying on saturation reduction or black point suppression to hide the artifact.
Scope and Intended Use
This tool is designed for stretched, pre-final images.
Use it as a last-resort correction step when your normal astrophotography workflow can no longer clean the background adequately.
It is optimized for large-scale, low-frequency background color mottle. It is not intended to fix high-frequency chroma noise or replace proper calibration and background extraction earlier in the pipeline.
Supported Formats
Input and output formats:
- TIFF: 8-bit integer, 16-bit integer, 32-bit float
- FITS: 8-bit integer, 16-bit integer, 32-bit float
Installation
Install from PyPI:
pip install color-mottle-corrector
Run
Start the application:
color-mottle-corrector
Workflow
1. Load Source Image
Choose an input TIFF or FITS file and click Load.
The original image will appear in the preview area. When loading and initial mask preparation are complete, click Next to continue.
2. Build the Protection Mask
Adjust the curve and mask controls, then click Apply mask.
Mask meaning:
- Black: protected region, little or no correction
- White: full correction applied
- Gray: partial correction, blended proportionally
Use Invert output to invert the mask response.
Use Mask blur radius to soften mask transitions and reduce hard correction boundaries.
3. Calculate Correction Fields
Select the Gaussian field scale from the available discrete values:
- 4
- 8
- 16
- 32
- 64
Then click Calculate to build the RG_field and BY_field.
The preview will show the low-frequency correction fields used to neutralize background color imbalance.
These previews are additionally modulated by the effective correction mask (apply_alpha) so you can see where correction is actually applied.
In most cases, the default value 32 works well and does not need adjustment.
Tune this only if field geometry is detected incorrectly, for example when color mottle structures are captured too coarsely or too fragmentedly.
4. Apply Correction
Set the correction strengths:
- RG strength (%)
- BY strength (%)
Then click Preview to see the corrected image.
Practical guidance:
- If the result introduces a visible color cast, reduce correction strength or refine the mask first.
- Better masking usually gives more natural results than simply increasing suppression strength.
- Apply conservatively to avoid flattening legitimate faint color variation in the background.
5. Save Output
Choose the output path and select the desired format and bit depth.
Then click Save.
Stretch Preview
A global Stretch image checkbox is available in the image preview during the Source, Correction, and Save stages. Enable it to apply a visual stretch for easier inspection of subtle background color mottle.
Algorithm Development Notebook
This repository also includes blotch_detection.ipynb, used to prototype and validate the core correction algorithm step by step.
Author
Alexey Zaytsev
lonelylockley@gmail.com
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file color_mottle_corrector-1.2.tar.gz.
File metadata
- Download URL: color_mottle_corrector-1.2.tar.gz
- Upload date:
- Size: 31.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
596726b09edbf103e687ed65077a9285cdc6e998698ecd93929642c710871386
|
|
| MD5 |
99902ea46cd2017322d7bed9747ca309
|
|
| BLAKE2b-256 |
ecfc7cd3fd7745e7839d7b05d28be18d4abf0e1202ea6c6a3ca83f344ec0e7b4
|
File details
Details for the file color_mottle_corrector-1.2-py3-none-any.whl.
File metadata
- Download URL: color_mottle_corrector-1.2-py3-none-any.whl
- Upload date:
- Size: 29.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3e730cd212af26f28740553419601d4dc43a299e633582ad81262d573c2f527a
|
|
| MD5 |
351bd4d45a44346da85c9ccb2bfa2c7e
|
|
| BLAKE2b-256 |
0044c242b21ef998a118be089d864ac8bde6d9b97284ebc4dc3ad446540594eb
|