gamma_image gamma_image GammaImage GammaImage (Operator)
Name
gamma_image gamma_image GammaImage GammaImage
— Perform a gamma encoding or decoding of an image.
Signature
Herror gamma_image (const Hobject Image , Hobject* GammaImage , double Gamma , double Offset , double Threshold , double MaxGray , const char* Encode )
Herror T_gamma_image (const Hobject Image , Hobject* GammaImage , const Htuple Gamma , const Htuple Offset , const Htuple Threshold , const Htuple MaxGray , const Htuple Encode )
void GammaImage (const HObject& Image , HObject* GammaImage , const HTuple& Gamma , const HTuple& Offset , const HTuple& Threshold , const HTuple& MaxGray , const HTuple& Encode )
HImage HImage ::GammaImage (double Gamma , double Offset , double Threshold , const HTuple& MaxGray , const HString& Encode ) const
HImage HImage ::GammaImage (double Gamma , double Offset , double Threshold , double MaxGray , const HString& Encode ) const
HImage HImage ::GammaImage (double Gamma , double Offset , double Threshold , double MaxGray , const char* Encode ) const
HImage HImage ::GammaImage (double Gamma , double Offset , double Threshold , double MaxGray , const wchar_t* Encode ) const
(Windows only)
static void HOperatorSet .GammaImage (HObject image , out HObject gammaImage , HTuple gamma , HTuple offset , HTuple threshold , HTuple maxGray , HTuple encode )
HImage HImage .GammaImage (double gamma , double offset , double threshold , HTuple maxGray , string encode )
HImage HImage .GammaImage (double gamma , double offset , double threshold , double maxGray , string encode )
Description
gamma_image gamma_image GammaImage GammaImage GammaImage
performs a general gamma encoding or decoding of
the input image Image Image Image Image image
and returns the resulting image in
GammaImage GammaImage GammaImage GammaImage gammaImage
. A generalized gamma encoding can be described
as follows:
Here, G' is the gamma-encoded gray value, G is the linear gray
value,
, o =
Offset Offset Offset Offset offset
, m = MaxGray MaxGray MaxGray MaxGray maxGray
, t = Threshold Threshold Threshold Threshold threshold
,
and s is a factor that is computed from Gamma Gamma Gamma Gamma gamma
,
Offset Offset Offset Offset offset
, Threshold Threshold Threshold Threshold threshold
, and MaxGray MaxGray MaxGray MaxGray 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
.
For example, the gamma encoding or decoding required by the sRGB
standard can be obtained by setting Gamma Gamma Gamma Gamma gamma
= 1.0/2.4,
Offset Offset Offset Offset offset
= 0.055, and Threshold Threshold Threshold Threshold threshold
= 0.0031308.
Similarly, the gamma encoding or decoding required by the HDTV video
standard can be obtained by setting Gamma Gamma Gamma Gamma gamma
= 0.45,
Offset Offset Offset Offset offset
= 0.099, and Threshold Threshold Threshold Threshold threshold
= 0.018. In any
case, MaxGray MaxGray MaxGray MaxGray maxGray
should be set as appropriate for the image
type of Image Image Image Image image
(e.g., 255.0 for byte images).
Attention
gamma_image gamma_image GammaImage GammaImage GammaImage
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
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 Image Image Image image
(input_object) (multichannel-)image(-array) →
object HImage HImage Hobject (byte* / uint2* / real*) *allowed for compute devices
Input image.
GammaImage GammaImage GammaImage GammaImage gammaImage
(output_object) (multichannel-)image(-array) →
object HImage HImage Hobject * (byte / uint2 / real)
Output image.
Gamma Gamma Gamma Gamma gamma
(input_control) real →
HTuple HTuple Htuple (real) (double ) (double ) (double )
Gamma coefficient of the exponential part of the
transformation.
Default value: 0.416666666667
Suggested values: 0.416666666667, 0.45
Offset Offset Offset Offset offset
(input_control) real →
HTuple HTuple Htuple (real) (double ) (double ) (double )
Offset of the exponential part of the transformation.
Default value: 0.055
Suggested values: 0.055, 0.099
Threshold Threshold Threshold Threshold threshold
(input_control) real →
HTuple HTuple Htuple (real) (double ) (double ) (double )
Gray value for which the transformation switches from
linear to exponential.
Default value: 0.0031308
Suggested values: 0.0031308, 0.018
MaxGray MaxGray MaxGray MaxGray maxGray
(input_control) number →
HTuple HTuple Htuple (real / integer) (double / int / long) (double / Hlong) (double / Hlong)
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
Encode Encode Encode Encode encode
(input_control) string →
HTuple HTuple Htuple (string) (string ) (HString ) (char* )
If 'true' "true" "true" "true" "true" , perform a gamma encoding,
otherwise a gamma decoding.
Default value:
'true'
"true"
"true"
"true"
"true"
List of values: 'false' "false" "false" "false" "false" , 'true' "true" "true" "true" "true"
Alternatives
pow_image pow_image PowImage PowImage PowImage
See also
sqrt_image sqrt_image SqrtImage SqrtImage SqrtImage
,
exp_image exp_image ExpImage ExpImage ExpImage
,
log_image log_image LogImage LogImage LogImage
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