Color.ChromaticAdaptation
(Color v0.4.0)
Copy Markdown
Chromatic adaptation transforms between reference whites.
Supported methods: :xyz_scaling, :bradford (default), :von_kries,
:sharp, :cmccat2000, :cat02. Matrices are from Bruce Lindbloom
(http://www.brucelindbloom.com/index.html?Eqn_ChromAdapt.html) and
the CAT02 / CMCCAT2000 literature.
All math is done with plain Elixir lists and floats; no Nx
dependency is required. Adaptation matrices are computed lazily and
memoised in :persistent_term.
Summary
Functions
Returns the 3x3 chromatic adaptation matrix as a list of rows.
Returns the (ρ, γ, β) cone response of a reference white under the
given adaptation method.
Functions
adaptation_matrix_list(source_illuminant, source_observer_angle, dest_illuminant, dest_observer_angle, adaptation_method \\ :bradford)
Returns the 3x3 chromatic adaptation matrix as a list of rows.
Arguments
source_illuminantis the source reference white atom.source_observer_angleis2or10.dest_illuminantis the destination reference white atom.dest_observer_angleis2or10.adaptation_methoddefaults to:bradford.
Returns
- A list of three three-element rows.
Examples
iex> m = Color.ChromaticAdaptation.adaptation_matrix_list(:D50, 2, :D65, 2)
iex> [[a, _, _] | _] = m
iex> Float.round(a, 4)
0.9556
Returns the (ρ, γ, β) cone response of a reference white under the
given adaptation method.
Arguments
illuminantis the illuminant atom.observer_angleis2or10.adaptation_methoddefaults to:bradford.
Returns
- A
{ρ, γ, β}tuple.