Skip to content

Instantly share code, notes, and snippets.

@KelSolaar
Last active June 22, 2017 22:18
Show Gist options
  • Save KelSolaar/708646f95bf92476d3f7 to your computer and use it in GitHub Desktop.
Save KelSolaar/708646f95bf92476d3f7 to your computer and use it in GitHub Desktop.
Whitepoint Change
set cut_paste_input [stack 0]
version 8.0 v1
CheckerBoard2 {
inputs 0
name CheckerBoard
selected true
xpos 70
ypos -81
}
set N1ef0a2e0 [stack 0]
ColorMatrix {
matrix {
{0.997789503 -0.00836600843 -0.0602693859}
{0.000398521213 1.00088304 0.00511657145}
{0.00256327284 0.015896121 1.12685204}
}
name D65_to_D75_no_chromatic_adaptation_ColorMatrix
selected true
xpos 180
ypos -57
}
push $N1ef0a2e0
ColorMatrix {
matrix {
{1.04709975 -0.0433274511 -0.00377231627}
{0.00207089421 0.997845221 8.38902708e-05}
{0.00301944016 0.0152122186 0.98176834}
}
name D65_to_D75_chromatic_adaptation_ColorMatrix
selected true
xpos 180
ypos -33
}
Viewer {
input_process false
name Viewer1
selected true
xpos 180
ypos -9
}
import numpy as np
import colour
D65 = colour.ILLUMINANTS['cie_2_1931']['D65']
D75 = colour.ILLUMINANTS['cie_2_1931']['D75']
# No chromatic adaptation.
cat = colour.chromatic_adaptation_matrix_VonKries(
colour.xy_to_XYZ(D65),
colour.xy_to_XYZ(D75),
'XYZ Scaling')
M = np.dot(colour.sRGB_COLOURSPACE.XYZ_to_RGB_matrix,
np.dot(cat, colour.sRGB_COLOURSPACE.RGB_to_XYZ_matrix))
print(M)
# [[ 9.97789503e-01 -8.36600843e-03 -6.02693859e-02]
# [ 3.98521213e-04 1.00088304e+00 5.11657145e-03]
# [ 2.56327284e-03 1.58961210e-02 1.12685204e+00]]
# Chromatic adaptation.
cat = colour.chromatic_adaptation_matrix_VonKries(
colour.xy_to_XYZ(D65),
colour.xy_to_XYZ(D75),
'CAT02')
# [[ 1.04709975e+00 -4.33274511e-02 -3.77231627e-03]
# [ 2.07089421e-03 9.97845221e-01 8.38902708e-05]
# [ 3.01944016e-03 1.52122186e-02 9.81768340e-01]]
M = np.dot(np.linalg.inv(colour.normalised_primary_matrix(
colour.sRGB_COLOURSPACE.primaries,
D75)),
np.dot(cat, colour.sRGB_COLOURSPACE.RGB_to_XYZ_matrix))
print(M)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment