← All projects

srgb_calibration

A Python library for end-to-end display color calibration using commodity colorimeters.

What it does

Takes raw colorimeter measurements from a display panel and produces calibration artifacts — 3D LUTs in .cube format and ICC profiles — that correct the display's color response to match the sRGB standard.

Technical approach

The pipeline uses 1D pre/post LUTs for tone response linearization, then constructs a 3D LUT using Newton iteration in drive space to invert the display's forward color model. Ramp-supplemented forward modeling captures the panel's actual primary gamut, which on modern panels is often wider than sRGB.

The library handles edge cases that trip up simpler approaches: clip-and-compensate for over-driven values, chord-bias correction, oscillation damping in Newton iteration, and non-monotonic cube file sanitization.

Performance

The algorithm effectively minimizes color calibration error caused by chromaticity shift and additivity issues. Using a 9×9×9 LUT, it regularly achieves ΔE2000 < 1.5 across the entire achievable color space, with an average ΔE2000 around or below 0.5 for common colors near the white point and skin tones — a mean ΔE2000 < 1.5 is generally considered professional-grade display performance.

Engineering practices

  • 52 unit and integration tests covering the full pipeline
  • .cube file I/O with spec-compliant parsing and export
  • ICC profile generation for OS-level color management
  • Tetrahedral and Trilinear interpolations for 3D LUT evaluation

Solved challenges

  • The Newton iteration may not find the best solution when the native color space is less than the target color space.