Color.CAM16UCS
(Color v0.4.0)
Copy Markdown
CAM16-UCS perceptual color space.
CAM16 is a full color appearance model (Li et al. 2017, an update of
CIECAM02). CAM16-UCS is its uniform-color-space projection —
a (J', a', b') triple where equal Euclidean distance corresponds
to equal perceptual difference, even better than CIELAB.
Conversions assume standard default viewing conditions:
Reference white: D65.
Adapting luminance
L_A = 64 / π / 5 ≈ 4.074cd/m².Background relative luminance
Y_b = 20.Average surround (
F = 1.0,c = 0.69,N_c = 1.0).
If you need non-default viewing conditions you can pass them as options.
Summary
Types
A Color.CAM16UCS colour. The CAM16-UCS uniform space coordinates:
j is lightness in [0, 100], a and b are red-green and
yellow-blue chromatic coordinates.
Functions
Converts CIE XYZ (D65, Y ∈ [0, 1]) to CAM16-UCS.
Converts CAM16-UCS to CIE XYZ (D65, Y ∈ [0, 1]).
Types
@type t() :: %Color.CAM16UCS{ a: float() | nil, alpha: Color.Types.alpha(), b: float() | nil, j: float() | nil }
A Color.CAM16UCS colour. The CAM16-UCS uniform space coordinates:
j is lightness in [0, 100], a and b are red-green and
yellow-blue chromatic coordinates.
Functions
Converts CIE XYZ (D65, Y ∈ [0, 1]) to CAM16-UCS.
Arguments
xyzis aColor.XYZstruct.optionsis a keyword list.
Options
:viewing_conditionsis a map with:xyz_w,:la,:yb, and:surround. Defaults to D65 /L_A = 4.074/Y_b = 20/ average.
Returns
- A
Color.CAM16UCSstruct wherejisJ',aisa',bisb'.
Examples
iex> {:ok, ucs} = Color.CAM16UCS.from_xyz(%Color.XYZ{x: 0.95047, y: 1.0, z: 1.08883, illuminant: :D65, observer_angle: 2})
iex> {Float.round(ucs.j, 2), :math.sqrt(ucs.a * ucs.a + ucs.b * ucs.b) < 3.0}
{100.0, true}
Converts CAM16-UCS to CIE XYZ (D65, Y ∈ [0, 1]).
Arguments
ucsis aColor.CAM16UCSstruct.optionsis a keyword list (seefrom_xyz/2).
Returns
- A
Color.XYZstruct tagged D65/2°.