Restoring "spectral distribution" of a palette

Real spectral distributions of colours are lost whenever conversion to XYZ happens, yet some tricks may produce certain correlating characteristics of a palette.

The procedure

Given a white point (x, y) in CIE xy, do the following:

  1. Define the illuminant ill using (x, y), according to CAT16 transform.
  2. For each colour:
    1. Using ill, convert it to CAM16UCS and extract chroma C (in [0; 1]).
    2. In CIE xy, determine its hue angle relative to (x, y).
    3. Based on hue, find the nearest spectral wavelength w or determine that the colour is in the non-spectral area. If the latter is the case, ignore the colour.
    4. Add w to the statistics with weight C.
  3. For each wavelength in statistics, define a gaussian function with a fixed standard deviation of choice and a multiplier equal to the weight of the particular wavelength.
  4. Sum those gaussians and normalise the result.

Choosing the white point

Considered options:

  1. Use something fixed (like D65).
  2. Use the centroid of the palette in CIE xy.

Issues

Many colours could map to the non-spectral area. If they are ignored, much information concerning the palette is lost.

Usage

Currently, probably just as a characteristic to evaluate certain aspects of the atmosphere the palette creates and compare those between palettes. Still, in pieces using the palette, distribution of colours is very flexible, which affects how the illuminant will be perceived.

TODO

  • Explore more possibilities.
  • Test with palettes composed of spectral data (Pantone?).