Skip to content

Commit

Permalink
Implement support for *Fujifilm* *F-Gamut C* RGB colourspace.
Browse files Browse the repository at this point in the history
Closes #1315.
  • Loading branch information
KelSolaar committed Dec 7, 2024
1 parent e34321e commit ed42442
Show file tree
Hide file tree
Showing 7 changed files with 65 additions and 5 deletions.
1 change: 1 addition & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1373,6 +1373,7 @@ RGB Colourspaces
'ERIMM RGB',
'Ekta Space PS 5',
'F-Gamut',
'F-Gamut C',
'FilmLight E-Gamut',
'Gamma 1.8 Encoded Rec.709',
'Gamma 2.2 Encoded AP1',
Expand Down
1 change: 1 addition & 0 deletions colour/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -848,6 +848,7 @@
"RGB_COLOURSPACE_ERIMM_RGB",
"RGB_COLOURSPACE_FILMLIGHT_E_GAMUT",
"RGB_COLOURSPACE_F_GAMUT",
"RGB_COLOURSPACE_F_GAMUT_C",
"RGB_COLOURSPACE_G18_REC709_SCENE",
"RGB_COLOURSPACE_G22_ADOBERGB_SCENE",
"RGB_COLOURSPACE_G22_AP1_SCENE",
Expand Down
1 change: 1 addition & 0 deletions colour/models/rgb/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -486,6 +486,7 @@
"RGB_COLOURSPACE_ERIMM_RGB",
"RGB_COLOURSPACE_FILMLIGHT_E_GAMUT",
"RGB_COLOURSPACE_F_GAMUT",
"RGB_COLOURSPACE_F_GAMUT_C",
"RGB_COLOURSPACE_G18_REC709_SCENE",
"RGB_COLOURSPACE_G22_ADOBERGB_SCENE",
"RGB_COLOURSPACE_G22_AP1_SCENE",
Expand Down
5 changes: 3 additions & 2 deletions colour/models/rgb/datasets/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
from .itur_bt_470 import RGB_COLOURSPACE_BT470_525, RGB_COLOURSPACE_BT470_625
from .itur_bt_709 import RGB_COLOURSPACE_BT709
from .itur_bt_2020 import RGB_COLOURSPACE_BT2020
from .fujifilm_f_gamut import RGB_COLOURSPACE_F_GAMUT
from .fujifilm import RGB_COLOURSPACE_F_GAMUT, RGB_COLOURSPACE_F_GAMUT_C
from .itut_h_273 import (
RGB_COLOURSPACE_H273_GENERIC_FILM,
RGB_COLOURSPACE_H273_22_UNSPECIFIED,
Expand Down Expand Up @@ -139,6 +139,8 @@
"RGB_COLOURSPACE_BT470_625",
"RGB_COLOURSPACE_BT709",
"RGB_COLOURSPACE_BT2020",
"RGB_COLOURSPACE_F_GAMUT",
"RGB_COLOURSPACE_F_GAMUT_C",
"RGB_COLOURSPACE_H273_GENERIC_FILM",
"RGB_COLOURSPACE_H273_22_UNSPECIFIED",
"RGB_COLOURSPACE_CIE_RGB",
Expand Down Expand Up @@ -186,7 +188,6 @@
"RGB_COLOURSPACE_sRGB",
"RGB_COLOURSPACE_V_GAMUT",
"RGB_COLOURSPACE_XTREME_RGB",
"RGB_COLOURSPACE_F_GAMUT",
]
__all__ += [
"RGB_COLOURSPACE_LIN_REC709_SCENE",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,24 +1,34 @@
"""
Fujifilm F-Gamut Colourspace
============================
Fujifilm Colourspaces
=====================
Define the *Fujifilm F-Gamut* colourspace:
Define the *Fujifilm* colourspaces:
- :attr:`colour.models.RGB_COLOURSPACE_F_GAMUT`.
- :attr:`colour.models.RGB_COLOURSPACE_F_GAMUT_C`.
References
----------
- :cite:`Fujifilm2022a` : Fujifilm. (2022). F-Log Data Sheet Ver.1.1 (pp.
1-4). https://dl.fujifilm-x.com/support/lut/F-Log_DataSheet_E_Ver.1.1.pdf
- :cite:`Fujifilm2024` : Fujifilm. (2024). F-Log2 C Data Sheet Ver.1.0.
Retrieved December 8, 2024, from
https://dl.fujifilm-x.com/support/lut/F-Log2C_DataSheet_E_Ver.1.0.pdf
"""

from __future__ import annotations

import numpy as np

from colour.colorimetry import CCS_ILLUMINANTS
from colour.hints import NDArrayFloat
from colour.models.rgb import (
RGB_Colourspace,
log_decoding_FLog,
log_decoding_FLog2,
log_encoding_FLog,
log_encoding_FLog2,
normalised_primary_matrix,
)
from colour.models.rgb.datasets.itur_bt_2020 import (
CCS_WHITEPOINT_BT2020,
Expand Down Expand Up @@ -76,3 +86,47 @@
----------
:cite:`Fujifilm2022a`
"""


PRIMARIES_F_GAMUT_C: NDArrayFloat = np.array(
[
[0.73470, 0.26530],
[0.02630, 0.97370],
[0.11730, -0.02240],
]
)
"""*Fujifilm F-Gamut C* colourspace primaries."""

WHITEPOINT_NAME_F_GAMUT_C: str = "D65"
"""*Fujifilm F-Gamut C* colourspace whitepoint name."""

CCS_WHITEPOINT_F_GAMUT_C: NDArrayFloat = CCS_ILLUMINANTS[
"CIE 1931 2 Degree Standard Observer"
][WHITEPOINT_NAME_F_GAMUT_C]
"""*Fujifilm F-Gamut C* colourspace whitepoint chromaticity coordinates."""

MATRIX_F_GAMUT_C_TO_XYZ: NDArrayFloat = normalised_primary_matrix(
PRIMARIES_F_GAMUT_C, CCS_WHITEPOINT_F_GAMUT_C
)
"""*Fujifilm F-Gamut C* colourspace to *CIE XYZ* tristimulus values matrix."""

MATRIX_XYZ_TO_F_GAMUT_C: NDArrayFloat = np.linalg.inv(MATRIX_F_GAMUT_C_TO_XYZ)
"""*CIE XYZ* tristimulus values to *Fujifilm F-Gamut C* colourspace matrix."""

RGB_COLOURSPACE_F_GAMUT_C: RGB_Colourspace = RGB_Colourspace(
"F-Gamut C",
PRIMARIES_F_GAMUT_C,
CCS_WHITEPOINT_F_GAMUT_C,
WHITEPOINT_NAME_F_GAMUT_C,
MATRIX_F_GAMUT_C_TO_XYZ,
MATRIX_XYZ_TO_F_GAMUT_C,
log_encoding_FLog2,
log_decoding_FLog2,
)
RGB_COLOURSPACE_F_GAMUT_C.__doc__ = """
*Fujifilm F-Gamut C* colourspace.
References
----------
:cite:`Fujifilm2024`
"""
1 change: 1 addition & 0 deletions docs/colour.models.rst
Original file line number Diff line number Diff line change
Expand Up @@ -508,6 +508,7 @@ RGB Colourspaces
RGB_COLOURSPACE_ERIMM_RGB
RGB_COLOURSPACE_FILMLIGHT_E_GAMUT
RGB_COLOURSPACE_F_GAMUT
RGB_COLOURSPACE_F_GAMUT_C
RGB_COLOURSPACE_G18_REC709_SCENE
RGB_COLOURSPACE_G22_ADOBERGB_SCENE
RGB_COLOURSPACE_G22_AP1_SCENE
Expand Down
1 change: 1 addition & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1108,6 +1108,7 @@ RGB Colourspaces
'ERIMM RGB',
'Ekta Space PS 5',
'F-Gamut',
'F-Gamut C',
'FilmLight E-Gamut',
'Gamma 1.8 Encoded Rec.709',
'Gamma 2.2 Encoded AP1',
Expand Down

0 comments on commit ed42442

Please sign in to comment.