colour.matrix_idt#

colour.matrix_idt(sensitivities: colour.characterisation.cameras.RGB_CameraSensitivities, illuminant: colour.colorimetry.spectrum.SpectralDistribution, training_data: Optional[colour.colorimetry.spectrum.MultiSpectralDistributions] = None, cmfs: Optional[colour.colorimetry.spectrum.MultiSpectralDistributions] = None, optimisation_factory: Callable = optimisation_factory_rawtoaces_v1, optimisation_kwargs: Optional[Dict] = None, chromatic_adaptation_transform: Optional[Union[Literal['Bianco 2010', 'Bianco PC 2010', 'Bradford', 'CAT02 Brill 2008', 'CAT02', 'CAT16', 'CMCCAT2000', 'CMCCAT97', 'Fairchild', 'Sharp', 'Von Kries', 'XYZ Scaling'], str]] = 'CAT02', additional_data: bool = False) Union[Tuple[numpy.ndarray, numpy.ndarray, numpy.ndarray, numpy.ndarray], Tuple[numpy.ndarray, numpy.ndarray]][source]#

Compute 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
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...])