gamma_imagegamma_imageGammaImageGammaImage (Operator)

Name

gamma_imagegamma_imageGammaImageGammaImage — Perform a gamma encoding or decoding of an image.

Signature

gamma_image(Image : GammaImage : Gamma, Offset, Threshold, MaxGray, Encode : )

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_imagegamma_imageGammaImageGammaImageGammaImage performs a general gamma encoding or decoding of the input image ImageImageImageImageimage and returns the resulting image in GammaImageGammaImageGammaImageGammaImagegammaImage. A generalized gamma encoding can be described as follows: Here, G' is the gamma-encoded gray value, G is the linear gray value, , o = OffsetOffsetOffsetOffsetoffset, m = MaxGrayMaxGrayMaxGrayMaxGraymaxGray, t = ThresholdThresholdThresholdThresholdthreshold, and s is a factor that is computed from GammaGammaGammaGammagamma, OffsetOffsetOffsetOffsetoffset, ThresholdThresholdThresholdThresholdthreshold, and MaxGrayMaxGrayMaxGrayMaxGraymaxGray 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 GammaGammaGammaGammagamma = 1.0/2.4, OffsetOffsetOffsetOffsetoffset = 0.055, and ThresholdThresholdThresholdThresholdthreshold = 0.0031308. Similarly, the gamma encoding or decoding required by the HDTV video standard can be obtained by setting GammaGammaGammaGammagamma = 0.45, OffsetOffsetOffsetOffsetoffset = 0.099, and ThresholdThresholdThresholdThresholdthreshold = 0.018. In any case, MaxGrayMaxGrayMaxGrayMaxGraymaxGray should be set as appropriate for the image type of ImageImageImageImageimage (e.g., 255.0 for byte images).

Attention

gamma_imagegamma_imageGammaImageGammaImageGammaImage 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

Parameters

ImageImageImageImageimage (input_object)  (multichannel-)image(-array) objectHImageHImageHobject (byte* / uint2* / real*) *allowed for compute devices

Input image.

GammaImageGammaImageGammaImageGammaImagegammaImage (output_object)  (multichannel-)image(-array) objectHImageHImageHobject * (byte / uint2 / real)

Output image.

GammaGammaGammaGammagamma (input_control)  real HTupleHTupleHtuple (real) (double) (double) (double)

Gamma coefficient of the exponential part of the transformation.

Default value: 0.416666666667

Suggested values: 0.416666666667, 0.45

OffsetOffsetOffsetOffsetoffset (input_control)  real HTupleHTupleHtuple (real) (double) (double) (double)

Offset of the exponential part of the transformation.

Default value: 0.055

Suggested values: 0.055, 0.099

ThresholdThresholdThresholdThresholdthreshold (input_control)  real HTupleHTupleHtuple (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

MaxGrayMaxGrayMaxGrayMaxGraymaxGray (input_control)  number HTupleHTupleHtuple (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

EncodeEncodeEncodeEncodeencode (input_control)  string HTupleHTupleHtuple (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_imagepow_imagePowImagePowImagePowImage

See also

sqrt_imagesqrt_imageSqrtImageSqrtImageSqrtImage, exp_imageexp_imageExpImageExpImageExpImage, log_imagelog_imageLogImageLogImageLogImage

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