colour.matrix_idt

colour.matrix_idt(sensitivities, illuminant, training_data=None, cmfs=XYZ_ColourMatchingFunctions(name='CIE 1931 2 Degree Standard Observer', ...), optimisation_factory=<function optimisation_factory_rawtoaces_v1>, optimisation_kwargs=None, chromatic_adaptation_transform='CAT02', additional_data=False)[source]

Computes an Input Device Transform (IDT) matrix for given camera RGB spectral sensitivities, illuminant, training data, standard observer colour matching functions and optimization settings according to RAW to ACES v1 and P-2013-001 procedures.

Parameters
  • sensitivities (RGB_CameraSensitivities) – Camera RGB spectral sensitivities.

  • illuminant (SpectralDistribution) – Illuminant spectral distribution.

  • training_data (MultiSpectralDistributions, optional) – Training data multi-spectral distributions, defaults to using the RAW to ACES v1 190 patches.

  • cmfs (XYZ_ColourMatchingFunctions) – Standard observer colour matching functions.

  • optimisation_factory (callable, optional) – Callable producing the objective function and the CIE XYZ to optimisation colour model function.

  • optimisation_kwargs (dict_like, optional) – Parameters for scipy.optimize.minimize() definition.

  • chromatic_adaptation_transform (unicode, optional) – {‘CAT02’, ‘XYZ Scaling’, ‘Von Kries’, ‘Bradford’, ‘Sharp’, ‘Fairchild’, ‘CMCCAT97’, ‘CMCCAT2000’, ‘CAT02 Brill 2008’, ‘Bianco 2010’, ‘Bianco PC 2010’, None}, Chromatic adaptation transform, if None no chromatic adaptation is performed.

  • additional_data (bool, optional) – If True, the XYZ and RGB tristimulus values are also returned.

Returns

tuple of Input Device Transform (IDT) matrix and white balance multipliers or tuple of Input Device Transform (IDT) matrix, white balance multipliers, XYZ and RGB tristimulus values.

Return type

tuple

References

[DFI+17], [TheAoMPAaSciencesScienceaTCouncilAcademyCESACESPSubcommittee15]

Examples

Computing the Input Device Transform (IDT) matrix for a CANON EOS 5DMark II and CIE Illuminant D Series D55 using the method given in RAW to ACES v1:

>>> path = os.path.join(
...     RESOURCES_DIRECTORY_RAWTOACES,
...     'CANON_EOS_5DMark_II_RGB_Sensitivities.csv')
>>> sensitivities = sds_and_msds_to_msds(
...     read_sds_from_csv_file(path).values())
>>> illuminant = SDS_ILLUMINANTS['D55']
>>> M, RGB_w = matrix_idt(sensitivities, illuminant)
>>> np.around(M, 3)
array([[ 0.85 , -0.016,  0.151],
       [ 0.051,  1.126, -0.185],
       [ 0.02 , -0.194,  1.162]])
>>> RGB_w  
array([ 2.3414154...,  1.        ,  1.5163375...])

The RAW to ACES v1 matrix for the same camera and optimized by Ceres Solver is as follows:

0.864994 -0.026302 0.161308 0.056527 1.122997 -0.179524 0.023683 -0.202547 1.178864

>>> M, RGB_w = matrix_idt(
...     sensitivities, illuminant,
...     optimisation_factory=optimisation_factory_JzAzBz)
>>> np.around(M, 3)
array([[ 0.848, -0.016,  0.158],
       [ 0.053,  1.114, -0.175],
       [ 0.023, -0.225,  1.196]])
>>> RGB_w  
array([ 2.3414154...,  1.        ,  1.5163375...])