gamma_imageπ
Short descriptionπ
gamma_image β Perform a gamma encoding or decoding of an image.
Signatureπ
gamma_image( image Image, out image GammaImage, real Gamma, real Offset, real Threshold, number MaxGray, string Encode )
Descriptionπ
gamma_image performs a general gamma encoding or decoding of
the input image Image and returns the resulting image in
GammaImage. A generalized gamma encoding can be described
as follows:
Here, \(G'\) is the gamma-encoded gray value, \(G\) is the linear gray
value, \(\gamma = \textrm{Gamma}\), \(o =
\textrm{Offset}\), \(m = \textrm{MaxGray}\), \(t = \textrm{Threshold}\),
and \(s\) is a factor that is computed from Gamma,
Offset, Threshold, and MaxGray in such a
way that the linear and exponential parts of the transformation are
continuous.
Analogously, a generalized gamma decoding can be described as follows:
where the variables have identical meanings as for the gamma encoding and \(t' = s t\).
For example, the gamma encoding or decoding required by the sRGB
standard can be obtained by setting \(\textrm{Gamma} = 1.0/2.4\),
\(\textrm{Offset} = 0.055\), and \(\textrm{Threshold} = 0.0031308\).
Similarly, the gamma encoding or decoding required by the HDTV video
standard can be obtained by setting \(\textrm{Gamma} = 0.45\),
\(\textrm{Offset} = 0.099\), and \(\textrm{Threshold} = 0.018\). In any
case, MaxGray should be set as appropriate for the image
type of Image (e.g., 255.0 for byte images).
Attentionπ
gamma_image can be executed on an OpenCL device for byte, uint2 and
real images. As the operation is performed in single precision floating
point instead of double precision as on the CPU, the result of the OpenCL
implementation can vary slightly from that of the CPU implementation.
Execution informationπ
Execution information
-
Supports OpenCL compute devices.
-
Multithreading type: reentrant (runs in parallel with non-exclusive operators).
-
Multithreading scope: global (may be called from any thread).
-
Automatically parallelized on tuple level.
-
Automatically parallelized on channel level.
-
Automatically parallelized on domain level.
Parametersπ
Image (input_object) (multichannel-)image(-array) β object (byte* / uint2* / real*) *allowed for compute devices
Input image.
GammaImage (output_object) (multichannel-)image(-array) β object (byte / uint2 / real)
Output image.
Gamma (input_control) real β (real)
Gamma coefficient of the exponential part of the transformation.
Default: 0.416666666667
Suggested values: 0.416666666667, 0.45
Offset (input_control) real β (real)
Offset of the exponential part of the transformation.
Default: 0.055
Suggested values: 0.055, 0.099
Threshold (input_control) real β (real)
Gray value for which the transformation switches from linear to exponential.
Default: 0.0031308
Suggested values: 0.0031308, 0.018
MaxGray (input_control) number β (real / integer)
Maximum gray value of the input image type.
Default: 255.0
Suggested values: 1.0, 255.0, 511.0, 1023.0, 4095.0, 16383.0, 65535.0
Encode (input_control) string β (string)
If 'true', perform a gamma encoding, otherwise a gamma decoding.
Default: 'true'
List of values: 'false', 'true'
Combinations with other operatorsπ
Referencesπ
Erik Reinhard, Erum Arif Khan, Ahmet Oguz AkyΓΌz, Garret M. Johnson: βColor Imaging: Fundamentals and Applications.β A K Peters, Ltd., 2008.
CEI/IEC 61966-2-1:1999: ``Colour management β Default RGB colour space β sRGB.ββ
ITU-R BT.709-5: ``Parameter values for the HDTV standards for production and international programme exchange.ββ
Moduleπ
Foundation