Skip to content

How to obtain the nits from the RGB value? #717

Answered by nick-shaw
chesschi asked this question in Q&A
Discussion options

You must be logged in to vote

Taking an example 10 bit RGB triple, [ 123, 456, 789 ] you would use the following code:

>>> import colour
>>> import numpy as np
>>> RGB_to_XYZ_matrix = colour.models.BT2020_COLOURSPACE.RGB_to_XYZ_matrix
>>> RGB_CV = np.array( [ 123, 456, 789 ] )
>>> RGB_lin = colour.models.eotf_ST2084(RGB_CV / 1023)
>>> colour.utilities.dot_vector(RGB_to_XYZ_matrix, RGB_lin)
array([  209.81942735,   106.90999103,  1269.42240872])

The luminance is the Y of XYZ, so the second component above, which is 106.9 nits in this example.

Replies: 3 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by KelSolaar
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #427 on January 16, 2021 22:46.