gamma_image — Perform a gamma encoding or decoding of an image.
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:
/ g | m * ( (1+o) * (G/m) - o ) , t < G/m <= 1 G' = < | s*G , 0 <= G/m <= t \
Here, G' is the gamma-encoded gray value, G is the linear gray value, g = Gamma, o = Offset, m = MaxGray, t = 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:
/ 1/g | m * ( ( G'/m + o ) / (1+o) ) , t' < G'/m <= 1 G = < | G'/s , 0 <= G'/m <= t' \
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 Gamma = 1.0/2.4, Offset = 0.055, and Threshold = 0.0031308. Similarly, the gamma encoding or decoding required by the HDTV video standard can be obtained by setting Gamma = 0.45, Offset = 0.099, and 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).
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.
Gamma coefficient of the exponential part of the transformation.
Default value: 0.416666666667
Suggested values: 0.416666666667, 0.45
Offset of the exponential part of the transformation.
Default value: 0.055
Suggested values: 0.055, 0.099
Gray value for which the transformation switches from linear to exponential.
Default value: 0.0031308
Suggested values: 0.0031308, 0.018
Maximum gray value of the input image type.
Default value: 255.0
Suggested values: 1.0, 255.0, 511.0, 1023.0, 4095.0, 16383.0, 65535.0
If 'true', perform a gamma encoding, otherwise a gamma decoding.
Default value: 'true'
List of values: 'false', 'true'
sqrt_image, exp_image, log_image
Erik Reinhard, Erum Arif Khan, Ahmet Oguz Akyüz, Garret M. Johnson:
“Color Imaging: Fundamentals and Applications.” A K Peters, Ltd.,
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.”