- All Implemented Interfaces:
GammaMapping
Defines the "modified gamma correction" used for converting linear to non-linear color component values. The mapping
function consists of a linear and non-linear part. In the forward mapping (applyFwd(double)
), the linear
part covers input values between a = 0,...,a0, while values a = a0,...,1 are mapped non-linearly. For the inverse
mapping (applyInv(double)
), the linear part is b = 0,...,b0, the non-linear part is b = b0,...,1.
Theoretically all mapping parameters can be derived from parameters gamma
and a0
(the linear to
non-linear transition point) only. Note that gamma
specifies the nominal γ parameter for the
forward (i.e., linear to non-linear) mapping, e.g., γ = 1/2.4 for sRGB. See Sec. 3.7.6 of [1] for more
details.
[1] W. Burger, M.J. Burge, Digital Image Processing – An Algorithmic Introduction, 3rd ed, Springer (2022).
- Version:
- 2022/11/14
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic ModifiedGammaMapping
Gamma mapping function instance for ITU-R BT.709 (see Table 3.1 of [1]).static ModifiedGammaMapping
Gamma mapping function instance for sRGB (see Table 3.1 of [1]). -
Constructor Summary
ConstructorsConstructorDescriptionModifiedGammaMapping
(double gamma, double a0) Constructor, derives parameters s and d from gamma and a0 (see Eq.ModifiedGammaMapping
(double gamma, double a0, double s, double d) Constructor, accepts explicit parameters s and d to allow for minor inaccuracies in published standards. -
Method Summary
Modifier and TypeMethodDescriptiondouble
applyFwd
(double a) Forward Gamma mapping (from linear to non-linear component values).float
applyFwd
(float a) Float version ofGammaMapping.applyFwd(double)
float[]
applyFwd
(float[] A) Forward Gamma mapping (from linear to non-linear component values).double
applyInv
(double b) Inverse Gamma mapping (from non-linear to linear component values).float
applyInv
(float b) Float version ofGammaMapping.applyInv(double)
float[]
applyInv
(float[] B) Inverse Gamma mapping (from non-linear to linear component values).protected static double
d
(double gamma, double a0) Function d(gamma, a0) derives the offset d of the non-linear section from parameters gamma and a0 (see Eq.protected static double
s
(double gamma, double a0) Function s(gamma, a0) derives the slope s of the linear section from parameters gamma and a0 (see Eq.
-
Field Details
-
ITU709
Gamma mapping function instance for ITU-R BT.709 (see Table 3.1 of [1]). -
sRGB
Gamma mapping function instance for sRGB (see Table 3.1 of [1]). Note that we need to specify parameters s and d too to comply strictly with the sRGB standard.
-
-
Constructor Details
-
ModifiedGammaMapping
Constructor, derives parameters s and d from gamma and a0 (see Eq. 3.35 in [1]).- Parameters:
gamma
- in [0,1], the nominal gamma value for the forward mapping (e.g., gamma = 1/2.4 for sRGB)a0
- in [0,1], the linear to non-linear transition point (e.g., a0 = 1/2.4 for sRGB)
-
ModifiedGammaMapping
Constructor, accepts explicit parameters s and d to allow for minor inaccuracies in published standards.- Parameters:
gamma
- in [0,1], the nominal gamma value for the forward mapping (e.g., gamma = 1/2.4 for sRGB)a0
- in [0,1], the linear to non-linear transition point (e.g., a0 = 1/2.4 for sRGB)s
- > 0, the slope s of the linear section (e.g., s = 12.92 for sRGB)d
- ≥ 0 the offset d of the non-linear section (e.g., s = 0.055 for sRGB)
-
-
Method Details
-
s
Function s(gamma, a0) derives the slope s of the linear section from parameters gamma and a0 (see Eq. 3.35 in [1]).- Parameters:
gamma
- the nominal gamma value for the forward mappinga0
- the linear to non-linear transition point- Returns:
- the slope s of the linear section
-
d
Function d(gamma, a0) derives the offset d of the non-linear section from parameters gamma and a0 (see Eq. 3.35 in [1]).- Parameters:
gamma
- the nominal gamma value for the forward mappinga0
- the linear to non-linear transition point- Returns:
- the offset d of the non-linear section
-
applyFwd
Description copied from interface:GammaMapping
Forward Gamma mapping (from linear to non-linear component values).- Specified by:
applyFwd
in interfaceGammaMapping
- Parameters:
a
- linear component value in [0,1]- Returns:
- the gamma-corrected (non-linear) component value
-
applyInv
Description copied from interface:GammaMapping
Inverse Gamma mapping (from non-linear to linear component values).- Specified by:
applyInv
in interfaceGammaMapping
- Parameters:
b
- non-linear (Gamma-corrected) component value in [0,1]- Returns:
- the linear component value
-
applyFwd
Description copied from interface:GammaMapping
Float version ofGammaMapping.applyFwd(double)
- Specified by:
applyFwd
in interfaceGammaMapping
- Parameters:
a
- linear component value in [0,1]- Returns:
- the gamma-corrected (non-linear) component value
-
applyInv
Description copied from interface:GammaMapping
Float version ofGammaMapping.applyInv(double)
- Specified by:
applyInv
in interfaceGammaMapping
- Parameters:
b
- non-linear (Gamma-corrected) component value in [0,1]- Returns:
- the linear component value
-
applyFwd
Forward Gamma mapping (from linear to non-linear component values).- Parameters:
A
- an array of linear component values in [0,1]- Returns:
- an array of gamma-corrected (non-linear) component values
-
applyInv
Inverse Gamma mapping (from non-linear to linear component values).- Parameters:
B
- an array of non-linear (Gamma-corrected) component value in [0,1]- Returns:
- an array of linear component values
-