Created
March 4, 2016 08:23
-
-
Save KelSolaar/451666b9060b70a71d20 to your computer and use it in GitHub Desktop.
Secondary Chromaticity Coordinates Computation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
P = np.array( | |
[[0.6650, 0.3220], | |
[0.2950, 0.6070], | |
[0.1500, 0.0600]]) | |
W = np.array([0.3127, 0.3290]) | |
NPM = colour.normalised_primary_matrix(P, W) | |
NPM_i = np.linalg.inv(NPM) | |
R = np.ravel(NPM)[3:6] # This is the Luminance ratios. | |
print(R) | |
# [ 0.20076008 0.72604503 0.07319489] | |
xyY_red = np.hstack((P[0], R[0])) | |
print(xyY_red) | |
# [ 0.66500000 0.32200000 0.20076008] | |
xyY_green = np.hstack((P[1], R[1])) | |
print(xyY_green) | |
# [ 0.29500000 0.60700000 0.72604503] | |
RGB_red = colour.XYZ_to_RGB(colour.xyY_to_XYZ(xyY_red), | |
W, | |
W, | |
XYZ_to_RGB_matrix=NPM_i) | |
RGB_green = colour.XYZ_to_RGB(colour.xyY_to_XYZ(xyY_green), | |
W, | |
W, | |
XYZ_to_RGB_matrix=NPM_i) | |
xy_yellow = colour.XYZ_to_xy( | |
colour.RGB_to_XYZ(RGB_red + RGB_green, | |
W, | |
W, | |
NPM)) | |
print(xy_yellow) | |
# [ 0.42177907 0.50934585] | |
# Spreadsheet: 0,4218 0,5093 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment