colour.colorimetry.multi_sds_to_XYZ_integration

colour.colorimetry.multi_sds_to_XYZ_integration(msds, cmfs=XYZ_ColourMatchingFunctions(name='CIE 1931 2 Degree Standard Observer', ...), illuminant=SpectralDistribution(name='1 Constant', ...), k=None, shape=SpectralShape(360, 780, 1))[source]

Converts given multi-spectral distributions to CIE XYZ tristimulus values using given colour matching functions and illuminant. The multi-spectral distribution can be either a colour.MultiSpectralDistributions class instance or an array_like in which case the shape must be passed.

Parameters:
  • msds (MultiSpectralDistributions or array_like) – Multi-spectral distributions, if an array_like the wavelengths are expected to be in the last axis, e.g. for a 512x384 multi-spectral image with 77 bins, msds shape should be (384, 512, 77).
  • cmfs (XYZ_ColourMatchingFunctions) – Standard observer colour matching functions.
  • illuminant (SpectralDistribution, optional) – Illuminant spectral distribution.
  • k (numeric, optional) – Normalisation constant \(k\). For reflecting or transmitting object colours, \(k\) is chosen so that \(Y = 100\) for objects for which the spectral reflectance factor \(R(\lambda)\) of the object colour or the spectral transmittance factor \(\tau(\lambda)\) of the object is equal to unity for all wavelengths. For self-luminous objects and illuminants, the constants \(k\) is usually chosen on the grounds of convenience. If, however, in the CIE 1931 standard colorimetric system, the \(Y\) value is required to be numerically equal to the absolute value of a photometric quantity, the constant, \(k\), must be put equal to the numerical value of \(K_m\), the maximum spectral luminous efficacy (which is equal to 683 \(lm\cdot W^{-1}\)) and \(\Phi_\lambda(\lambda)\) must be the spectral concentration of the radiometric quantity corresponding to the photometric quantity required.
  • shape (SpectralShape, optional) – Spectral shape of the multi-spectral distributions, cmfs and illuminant will be aligned to it.
Returns:

CIE XYZ tristimulus values, for a 512x384 multi-spectral image with 77 bins, the output shape will be (384, 512, 3).

Return type:

array_like

Notes

Range Scale - Reference Scale - 1
XYZ [0, 100] [0, 1]
  • The code path using the array_like multi-spectral distributions produces results different to the code path using a colour.MultiSpectralDistributions class instance: the former favours execution speed by aligning the colour matching functions and illuminant to the given spectral shape while the latter favours precision by aligning the multi-spectral distributions to the colour matching functions.

References

[Wyszecki2000bf]

Examples

>>> from colour import ILLUMINANTS_SDS
>>> shape = SpectralShape(400, 700, 60)
>>> D65 = ILLUMINANTS_SDS['D65']
>>> data = np.array([
...     [0.0137, 0.0159, 0.0096, 0.0111, 0.0179, 0.1057, 0.0433,
...      0.0258, 0.0248, 0.0186, 0.0310, 0.0473],
...     [0.0913, 0.3145, 0.2582, 0.0709, 0.2971, 0.4620, 0.2683,
...      0.0831, 0.1203, 0.1292, 0.1682, 0.3221],
...     [0.0152, 0.0842, 0.4139, 0.0220, 0.5630, 0.1918, 0.2373,
...      0.0430, 0.0054, 0.0079, 0.3719, 0.2268],
...     [0.0281, 0.0907, 0.2228, 0.1249, 0.2375, 0.5625, 0.0518,
...      0.3230, 0.0065, 0.4006, 0.0861, 0.3161],
...     [0.1918, 0.7103, 0.0041, 0.1817, 0.0024, 0.4209, 0.0118,
...      0.2302, 0.1860, 0.9404, 0.0041, 0.1124],
...     [0.0430, 0.0437, 0.3744, 0.0020, 0.5819, 0.0027, 0.0823,
...      0.0081, 0.3625, 0.3213, 0.7849, 0.0024],
... ])
>>> msds = MultiSpectralDistributions(data, shape.range())
>>> multi_sds_to_XYZ_integration(msds, illuminant=D65, shape=shape)
... # doctest: +ELLIPSIS
array([[  7.5031039...,   3.9486887...,   8.4053425...],
       [ 26.9265732...,  15.0721676...,  28.7125195...],
       [ 16.7039284...,  28.2175962...,  25.6515081...],
       [ 11.5765075...,   8.6399161...,   6.5783111...],
       [ 18.7324243...,  35.0755847...,  30.1525320...],
       [ 45.1654991...,  39.6132308...,  43.6877410...],
       [  8.1765955...,  13.0937369...,  25.9477816...],
       [ 22.4668631...,  19.3095206...,   7.9654068...],
       [  6.5782666...,   2.5254216...,  11.0954901...],
       [ 43.9134487...,  27.9794809...,  11.731893 ...],
       [  8.5371481...,  19.7034075...,  17.7088101...],
       [ 23.9092001...,  26.2129391...,  30.6831630...]])
>>> msds = np.array([
...     [
...         [0.0137, 0.0913, 0.0152, 0.0281, 0.1918, 0.0430],
...         [0.0159, 0.3145, 0.0842, 0.0907, 0.7103, 0.0437],
...         [0.0096, 0.2582, 0.4139, 0.2228, 0.0041, 0.3744],
...         [0.0111, 0.0709, 0.0220, 0.1249, 0.1817, 0.0020],
...         [0.0179, 0.2971, 0.5630, 0.2375, 0.0024, 0.5819],
...         [0.1057, 0.4620, 0.1918, 0.5625, 0.4209, 0.0027],
...     ],
...     [
...         [0.0433, 0.2683, 0.2373, 0.0518, 0.0118, 0.0823],
...         [0.0258, 0.0831, 0.0430, 0.3230, 0.2302, 0.0081],
...         [0.0248, 0.1203, 0.0054, 0.0065, 0.1860, 0.3625],
...         [0.0186, 0.1292, 0.0079, 0.4006, 0.9404, 0.3213],
...         [0.0310, 0.1682, 0.3719, 0.0861, 0.0041, 0.7849],
...         [0.0473, 0.3221, 0.2268, 0.3161, 0.1124, 0.0024],
...     ],
... ])
>>> multi_sds_to_XYZ_integration(msds, illuminant=D65, shape=shape)
... # doctest: +ELLIPSIS
array([[[  7.1958378...,   3.8605390...,  10.1016398...],
        [ 25.5738615...,  14.7200581...,  34.8440007...],
        [ 17.5854414...,  28.5668344...,  30.1806687...],
        [ 11.3271912...,   8.4598177...,   7.9015758...],
        [ 19.6581831...,  35.5918480...,  35.1430220...],
        [ 45.8212491...,  39.2600939...,  51.7907710...]],
<BLANKLINE>
       [[  8.8287837...,  13.3870357...,  30.5702050...],
        [ 22.3324362...,  18.9560919...,   9.3952305...],
        [  6.6887212...,   2.5728891...,  13.2618778...],
        [ 41.8166227...,  27.1191979...,  14.2627944...],
        [  9.2414098...,  20.2056200...,  20.1992502...],
        [ 24.7830551...,  26.2221584...,  36.4430633...]]])