Skip to content

Instantly share code, notes, and snippets.

@KelSolaar
Created March 28, 2017 04:47
Show Gist options
  • Save KelSolaar/89d7799ab6c49613c7ca2e5684d59b7a to your computer and use it in GitHub Desktop.
Save KelSolaar/89d7799ab6c49613c7ca2e5684d59b7a to your computer and use it in GitHub Desktop.
EOS C700 - Primaries Derivation
# IDT.Canon.EOSC700_CanonLog_CinemaGamut_TypeC_D55.a1.v1.ctl
import numpy as np
import colour
EOSC700_CINEMAGAMUT_TO_ACES_2065_1 = np.array(
[[0.763064455, 0.149021161, 0.087914384],
[0.003657457, 1.10696038, -0.110617837],
[-0.009407794, - 0.218383305, 1.227791099]])
EOS_CINEMAGAMUT_TO_ACES_2065_1_MATRICES = {
'EOS C700': EOSC700_CINEMAGAMUT_TO_ACES_2065_1}
def RGB_to_RGB_matrix_to_normalised_primary_matrix(RGB_to_RGB_matrix,
XYZ_to_RGB_matrix):
M = np.einsum('...ij,...jk->...ik', RGB_to_RGB_matrix, XYZ_to_RGB_matrix)
M = np.linalg.inv(M)
return M
def EOS_CinemaGamut_colourspaces_derivation():
EOS_CinemaGamut_colourspaces = {}
for name, RGB_to_RGB_matrix in EOS_CINEMAGAMUT_TO_ACES_2065_1_MATRICES.items():
NPM = RGB_to_RGB_matrix_to_normalised_primary_matrix(
np.linalg.inv(RGB_to_RGB_matrix),
colour.RGB_COLOURSPACES['ACES2065-1'].XYZ_to_RGB_matrix)
P, W = colour.primaries_whitepoint(NPM)
EOS_CinemaGamut_colourspaces[name] = colour.RGB_Colourspace(
name,
primaries=P,
whitepoint=W,
illuminant='D60',
RGB_to_XYZ_matrix=NPM,
XYZ_to_RGB_matrix=np.linalg.inv(NPM))
return EOS_CinemaGamut_colourspaces
EOS_CINEMAGAMUT_COLOURSPACES = EOS_CinemaGamut_colourspaces_derivation()
print(EOS_CINEMAGAMUT_COLOURSPACES['EOS C700'].primaries)
# [[ 0.73929471 0.2703585 ]
# [ 0.17859991 1.09863146]
# [ 0.07084927 -0.11732917]]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment