Skip to main content

ColorCorrectionPipeline

Calibrate a camera setup from one photo of a color chart (a ColorChecker Classic 24, SpyderCHECKR 24 or ColorChecker Digital SG), then apply that calibration to every image taken under the same conditions.

The pipeline corrects, in order: uneven lighting (flat-field correction, from an optional photo of a white target), tone (gamma), color cast (white balance), and remaining color error (color correction).

Install

pip install ColorCorrectionPipeline

Python 3.8–3.14 on Windows, Linux and macOS. On Python 3.10+ for Windows, Linux and Apple-silicon Macs this also installs Numba, which makes fitting and correcting 10–20× faster with identical results. On Python 3.8/3.9 or an Intel Mac, add it with pip install "ColorCorrectionPipeline[performance]". To read compressed 16-bit TIFFs, add [tiff]. Chart detection uses a GPU when one is available and falls back to the CPU on its own.

Quick start

You need a photo of the chart and, optionally, a photo of a plain white target taken with the same lighting and camera position.

from ColorCorrectionPipeline import calibrate, correct

cal = calibrate("chart.jpg", white="white.jpg", save_to="calibration.ccpb")
print("Chart error after correction (mean Delta E00):", cal.delta_e)

image = correct("scene.jpg", cal)                 # RGB float array, values 0–1
image = correct("scene.jpg", "calibration.ccpb")  # later, from the saved file
  • Leave out white= if you have no white photo; flat-field correction is then skipped.
  • calibrate raises CalibrationError if a stage fails, for example when no chart is found.
  • The .ccpb file is a portable calibration you can share and reload safely.

To save the result as an image file:

from ColorCorrectionPipeline.io import write_image_data

write_image_data("scene_corrected.png", image, dtype="uint8", allow_precision_loss=True)

Which chart?

The detector recognises three charts and picks the matching reference values for you:

Chart Patches Status
ColorChecker Classic 24 (and the Passport's Classic face) 24 Fully supported
SpyderCHECKR 24 24 New: verified on synthetic charts, not yet on real photos
ColorChecker Digital SG 140 New: verified on synthetic charts, not yet on real photos

calibrate() uses whichever chart is in the photo (a Classic wins if there are several). To choose one, pass chart_type="spyder" or "digital-sg".

If you measured your own chart, use its values instead of the built-in ones:

from ColorCorrectionPipeline import Config, ReferenceProfile, calibrate

reference = ReferenceProfile.from_csv("my_chart.csv", chart="classic")  # Lab D50 by default
cal = calibrate("chart.jpg", white="white.jpg", config=Config(reference=reference))

Values can be Lab, XYZ or sRGB, under any standard white, in row- or column-major order or labelled by cell. See chart reference values.

Correct many images

from ColorCorrectionPipeline import ColorCorrection

pipeline = ColorCorrection().load_bundle("calibration.ccpb")
results = pipeline.predict_images(["a.jpg", "b.jpg", "c.jpg"], stages="final")
corrected = [r["CC"] for r in results]            # same order as the input

stages="final" returns only the finished image, which is faster than keeping every intermediate stage. See batch processing for progress callbacks, worker counts and writing results to disk.

Configure

The defaults suit most photographs. To change the color model, pass a preset name:

cal = calibrate("chart.jpg", white="white.jpg", model="rpcc3")
Preset Use when
rpcc2 (default) General use. Robust to exposure changes.
rpcc3 A well-exposed chart and you want a closer fit.
ccm (or 3x3) You want a simple 3×3 matrix.
pls Many correlated features.
high-precision Your scenes are 16-bit or float.

For anything else, such as turning stages off, flat-field options, neural-network or PLS models, CPU-only detection, build a Config:

from ColorCorrectionPipeline import Config, calibrate

config = Config.from_preset("rpcc2", steps={"ffc": {"apply": {"domain": "linear"}}})
cal = calibrate("chart.jpg", white="white.jpg", config=config)

The configuration guide has a recipe for each common task and a table of every setting with its default.

Try it on the sample photos

The package ships a sample chart, white target and scene:

python -m ColorCorrectionPipeline.examples.quickstart --output demo
python -m ColorCorrectionPipeline.examples.apply_bundle --bundle demo/calibration.ccpb --image my_photo.jpg --output replay

The first command calibrates and writes demo/calibration.ccpb, a corrected image and the metrics. The second applies that calibration to your own photo.

Upgrading from 2.x

3.0 removed the old fitting recipes (legacy-v1, reproducible-v1, API-1 configuration dictionaries, MCC detection and key_functions). Requesting one raises an error that names its replacement. Calibrations saved by 2.x still load and give the same output. See migrating to 3.0, or pin ColorCorrectionPipeline==2.3.0 to keep the old recipes.

Documentation

A desktop app with the same workflow is available as ColorCorrect Studio.

Development

pip install -e ".[dev,performance]"
pytest tests
black --check ColorCorrectionPipeline tests scripts
ruff check ColorCorrectionPipeline tests scripts
mypy ColorCorrectionPipeline

See architecture for how the code is organized.

License and citation

The Python code is MIT licensed. The bundled chart-detection models are AGPL-3.0; see their notices.

If you use this package in research, please cite:

Wakholi, C., Hardigan, M. A., Lee, J., Lukas, S. B., Feldman, M. J., Altendorf, K. R., Neyhart, J. L., & Rippner, D. A. (2026). A systematic color correction pipeline for controlled-environment imaging. The Plant Phenome Journal, 9(1), e70067. doi:10.1002/ppj2.70067

Thanks to Devin A. Rippner for technical guidance, ORISE for fellowship support, and USDA-ARS for research support. Report an issue.

Metadata

Release files for ColorCorrectionPipeline 3.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ColorCorrectionPipeline 3.1.0
File Size Uploaded Provenance Actions
colorcorrectionpipeline-3.1.0.tar.gz 75.1 MB With provenance Details for colorcorrectionpipeline-3.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for ColorCorrectionPipeline 3.1.0
File Interpreter ABI Platform Actions
colorcorrectionpipeline-3.1.0-py3-none-any.whl Python 3 none any Details for colorcorrectionpipeline-3.1.0-py3-none-any.whl

Total release size: 146.7 MB

Release files / colorcorrectionpipeline-3.1.0.tar.gz

Download URL colorcorrectionpipeline-3.1.0.tar.gz
Size 75.1 MB
Tags Source
SHA-256 checksum
How to use checksums
9d15cfd50d42cfdd6461cd9b8844dd76c7ce27970bcdc5e638fd512e622542b8
BLAKE2b-256 checksum
How to use checksums
1f5930189cd191395a81a0ae59c7e32d46f7fab9c1ecb4e7aa8b5ee0ee2e8fdb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 25, 2026.

Transparency log

Release files / colorcorrectionpipeline-3.1.0-py3-none-any.whl

Download URL colorcorrectionpipeline-3.1.0-py3-none-any.whl
Size 71.7 MB
Tags Python 3
SHA-256 checksum
How to use checksums
bc37e7ba65b1e5015988aa1828a31c4438e5ab73be66b117e3883c3d049434fe
BLAKE2b-256 checksum
How to use checksums
ad38e45d41bb1cf42c63b389375613ac59676759f677d243d1d70519dade945d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 25, 2026.

Transparency log

Security for ColorCorrectionPipeline 3.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for colorcorrectionpipeline-3.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 25, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page