gamma_image gamma_image GammaImage GammaImage gamma_image (Operator)
Name
gamma_image gamma_image GammaImage GammaImage gamma_image
— 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 gamma_image
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 gamma_image
. 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 max_gray
, 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 max_gray
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 max_gray
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 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
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 HObject HObject Hobject (byte* / uint2* / real*) *allowed for compute devices
Input image.
GammaImage GammaImage GammaImage gammaImage gamma_image
(output_object) (multichannel-)image(-array) →
object HImage HObject HObject Hobject * (byte / uint2 / real)
Output image.
Gamma Gamma Gamma gamma gamma
(input_control) real →
HTuple float HTuple Htuple (real) (double ) (double ) (double )
Gamma coefficient of the exponential part of the
transformation.
Default:
0.416666666667
Suggested values:
0.416666666667, 0.45
Offset Offset Offset offset offset
(input_control) real →
HTuple float HTuple Htuple (real) (double ) (double ) (double )
Offset of the exponential part of the transformation.
Default:
0.055
Suggested values:
0.055, 0.099
Threshold Threshold Threshold threshold threshold
(input_control) real →
HTuple float HTuple Htuple (real) (double ) (double ) (double )
Gray value for which the transformation switches from
linear to exponential.
Default:
0.0031308
Suggested values:
0.0031308, 0.018
MaxGray MaxGray MaxGray maxGray max_gray
(input_control) number →
HTuple Union[float, int] HTuple Htuple (real / integer) (double / int / long) (double / Hlong) (double / Hlong)
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 Encode Encode encode encode
(input_control) string →
HTuple str HTuple Htuple (string) (string ) (HString ) (char* )
If 'true' "true" "true" "true" "true" , perform a gamma encoding,
otherwise a gamma decoding.
Default:
'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 pow_image
See also
sqrt_image sqrt_image SqrtImage SqrtImage sqrt_image
,
exp_image exp_image ExpImage ExpImage exp_image
,
log_image log_image LogImage LogImage log_image
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