After working on PGS subtitle extraction, which involves conversion of BT.709 YCbCr to the sRGB color space, I continued investigating other aspects of colorimetry. This project contains C-language tools developed during that work.
The intent is to work from first principles to the greatest extent practical. The programs therefore work directly with CIE color-matching functions (CMFs). The bundled CMF data were obtained from the Colour & Vision Research Laboratory (CVRL).
For display on a typical computer monitor, sRGB uses the D65 white point and the same RGB chromaticity primaries as BT.709. The programs can apply the sRGB transfer function to linear RGB values where appropriate. Other RGB primaries and white points are available in some programs for comparison and experimentation.
The original CIE 1931 standard observer was based on a 2° field of view. Because cone distribution across the retina is not uniform, the CIE later standardized a 10° observer in 1964 for applications involving a larger field of view.
Derives RGB-to-XYZ and XYZ-to-RGB conversion matrices for a selected RGB color space and white point, and suggests the native/reference white associated with each defined RGB space where one is known.
Each CSV row contains wavelength in nanometres followed by x̄, ȳ, and z̄. There is no header row.
Visible spectrum results
These images were generated by the visible-spectrum program using the indicated color-matching functions and white reference. The available CMF wavelength ranges are not all the same. As noted above, the resulting sRGB colors are display approximations because monochromatic spectral colors lie outside the sRGB gamut.
On a system with GCC and make, clone the repository and run:
make
The Makefile builds locus, matrix, vis-spec, and wl in the repository root. The programs are interactive; for example:
./wl
The CMF-reading programs use the files under data/ for their built-in choices. locus and vis-spec write out.bmp and refuse to overwrite an existing file of that name.