Background

CIEDE2000 is the current standard for perceptually uniform color difference (deltaE) in CIELAB space. The pure Python / vectorized numpy path via scikit-image's deltaE_ciede2000 works fine at moderate scale, but becomes a bottleneck when computing distances against large color gamuts (e.g. 2^24 entries). This package wraps a C implementation to close that gap.

Motivation

The immediate use case was a larger project requiring fast nearest-color lookup in a full screen gamut. Beyond that, this served as a concrete exercise in wrapping C in Python: passing array pointers across the boundary, writing the glue layer, and compiling C through setup.py at pip install time. The benchmarking notebook documents the comparison against the scikit-image baseline.

Implementation

  • C core taken from gfiumara/CIEDE2000 with minor modifications and added wrapper functions
  • Two entry points: deltaE_min returns the single nearest-color distance, deltaE_matrix returns the full distance array against a gamut
  • Both inputs expected in CIELAB colorspace; no colorspace conversion included
  • Non-exhaustive benchmarks showed lower memory consumption and faster execution than the vectorized numpy equivalent for large gamuts