Skip to main content

ColorCorrectionPipeline

Calibrate a camera setup from one photo of a ColorChecker Classic 24 chart, 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)

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, or your own chart reference values, 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.0.1

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.0.1
File Size Uploaded Provenance Actions
colorcorrectionpipeline-3.0.1.tar.gz 75.0 MB With provenance Details for colorcorrectionpipeline-3.0.1.tar.gz

Built distribution (wheel)

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

Total release size: 146.7 MB

Release files / colorcorrectionpipeline-3.0.1.tar.gz

Download URL colorcorrectionpipeline-3.0.1.tar.gz
Size 75.0 MB
Tags Source
SHA-256 checksum
How to use checksums
68ed3fe919ffd010aae5b0554a36c7a64d667924178517fb88ba25d91016795d
BLAKE2b-256 checksum
How to use checksums
5e1e58f2855bdf3c58d12904cbb87b55ad9f85f33540608d102553347064862c
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 24, 2026.

Transparency log

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

Download URL colorcorrectionpipeline-3.0.1-py3-none-any.whl
Size 71.7 MB
Tags Python 3
SHA-256 checksum
How to use checksums
e749aba4dccd0eb7e8d07222039eed3dd2b599f7194488c1662d0b51f89ecc67
BLAKE2b-256 checksum
How to use checksums
706d00f792dc4dd3cdc3d53758331f215edd5243c438ae85d5e249e197c9eeb6
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 24, 2026.

Transparency log

Security for ColorCorrectionPipeline 3.0.1

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.0.1.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 24, 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