Skip to content

Why "colour.xy_to_CCT(xy, 'McCamy 1992')" definition return value doesn't match the formula? #821

Answered by KelSolaar
lishichengyan asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @lishichengyan,

So your code is not quite correct for two reasons:

  1. The colour.sRGB_to_XYZ convenience definition assumes that data is encoded non-linearly and thus will decode it. You should pass apply_cctf_decoding=False.
  2. The previous point is actually irrelevant because the RGB space from the paper is from a sensor, not sRGB thus you need to use the given 3x3 RGB to XYZ matrix.

Keeping all that in mind:

import colour
import numpy as np

RGB = np.array([231.0, 260.0, 95.0])
M = [
    [-0.14282, +1.54924, -0.95641],
    [-0.32466, +1.57837, -0.73191],
    [-0.68202, +0.77073, +0.56332 ],
]
XYZ = colour.algebra.vector_dot(M, RGB)
xy = colour.XYZ_to_xy(XYZ)
colour.xy_to_CCT(xy, 'McCamy…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@lishichengyan
Comment options

Answer selected by KelSolaar
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
2 participants
Converted from issue

This discussion was converted from issue #820 on June 10, 2021 08:04.