ZtoRGBpy.RGBColorProfile¶
-
class
RGBColorProfile
(weights=(2126.0, 7152.0, 722.0), gamma=0.5)[source]¶ Defines a color profile in a given RGB color space by conversion factors for red, green and blue to the Y component of the XYZ color space, i.e. the white point.
Parameters: -
apply_gamma
(rgb)[source]¶ Applies gamma correction to color
Parameters: rgb ( array_like
[…]) – non-gamma corrected RGB color valuesReturns: RGB ( array
[rgb.shape
]) – gamma corrected RGB color valuesNotes
Equivalent to \({RGB} = {rgb}^{\gamma}\)
-
get_chroma_limit
()[source]¶ Return the limiting chroma
Returns: chroma_limit ( float
) – Limiting Chroma for the colorspaceNotes
The limiting chroma is computed from the transformation matrix as described in Fletcher 2019[1].
-
get_limits
()[source]¶ Returns \(U_{max}\) and \(V_{max}\)
Returns: Notes
\(U_{max}\) and \(V_{max}\) represent the limits of the UV color space, as defined by[1]:
\[\begin{split}V_{max} =& \frac{\sqrt[3]{K_R}}{\sqrt[3]{K_R} + \sqrt[3]{K_B}}\\ U_{max} =& \frac{\sqrt[3]{K_B}}{\sqrt[3]{K_R} + \sqrt[3]{K_B}}\end{split}\]
-
get_ratios
()[source]¶ Returns the relative ratios for red and blue
Returns: Notes
Ratios for red (\(K_R\)) and blue (\(K_B\)) are defined by:
\[\begin{split}K_R =& \frac{W_R}{W_R + W_G + W_B}\\ K_B =& \frac{W_B}{W_R + W_G + W_B}\end{split}\]
-
get_transform
()[source]¶ Returns the UV to RGB transformation matrix \(\mathbf{K_Q}\).
Returns: transformation ( array
[3, 2, dtype =float
]) – transformation matrix \(\mathbf{K_Q}\)Notes
The transformation matrix \(\mathbf{K_Q}\) is defined by[1]:
\[\begin{split}\mathbf{K_Q} &= \left[\begin{matrix} 0 & \frac{1-K_R}{V_{max}} \\ \frac{K_B\left( 1-K_B \right)}{U_{max}\left( K_B+K_R-1 \right)} & \frac{K_R\left( 1-K_R \right)}{V_{max}\left( K_B+K_R-1 \right)}\\ \frac{1-K_B}{U_{max}} & 0 \\ \end{matrix}\right]\end{split}\]
-
remove_gamma
(RGB)[source]¶ Removes gamma correction from color
Parameters: RGB ( array_like
[…]) – gamma corrected RGB color valuesReturns: rgb ( array
[RGB.shape
]) – non-gamma corrected RGB color valuesNotes
Equivalent to \({rgb} = {RGB}^{\frac{1}{\gamma}}\)
-
Predefined Color Profiles¶
sRGB_LOW
Defines a color profile in a given RGB color space by conversion factors for red, green and blue to the Y component of the XYZ color space, i.e. sRGB_HIGH
Defines a color profile in a given RGB color space by conversion factors for red, green and blue to the Y component of the XYZ color space, i.e. sRGB
Defines a color profile in a given RGB color space by conversion factors for red, green and blue to the Y component of the XYZ color space, i.e.
[1] | (1, 2, 3) Glen Fletcher. A Perceptually Uniform RGB Subset for Representing Complex-valued Data. Technical Report, University of Technology Sydney, 2019. URL: https://glenfletcher.com/research/a-perceptually-uniform-rgb-subset-for-representing-complex-valued-data/. |
[2] | International Electrotechnical Commission. Colour Measurement and Management in Multimedia Systems and Equipment. 1998. URL: http://www2.units.it/ipl/students_area/imm2/files/Colore1/sRGB.pdf. |