ClassesClassesClassesClasses | | | | Operators

gamma_imagegamma_imageGammaImagegamma_imageGammaImageGammaImage (Operator)

Name

gamma_imagegamma_imageGammaImagegamma_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)

Herror gamma_image(Hobject Image, Hobject* GammaImage, const HTuple& Gamma, const HTuple& Offset, const HTuple& Threshold, const HTuple& MaxGray, const HTuple& Encode)

HImage HImage::GammaImage(const HTuple& Gamma, const HTuple& Offset, const HTuple& Threshold, const HTuple& MaxGray, const HTuple& Encode) const

HImageArray HImageArray::GammaImage(const HTuple& Gamma, const HTuple& Offset, const HTuple& Threshold, const HTuple& MaxGray, const HTuple& Encode) const

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

void HOperatorSetX.GammaImage(
[in] IHUntypedObjectX* Image, [out] IHUntypedObjectX*GammaImage, [in] VARIANT Gamma, [in] VARIANT Offset, [in] VARIANT Threshold, [in] VARIANT MaxGray, [in] VARIANT Encode)

IHImageX* HImageX.GammaImage(
[in] double Gamma, [in] double Offset, [in] double Threshold, [in] VARIANT MaxGray, [in] BSTR Encode)

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_imageGammaImagegamma_imageGammaImageGammaImage performs a general gamma encoding or decoding of the input image ImageImageImageImageImageimage and returns the resulting image in GammaImageGammaImageGammaImageGammaImageGammaImagegammaImage. A generalized gamma encoding can be described as follows:

Here, G' is the gamma-encoded gray value, G is the linear gray value, , o = OffsetOffsetOffsetOffsetOffsetoffset, m = MaxGrayMaxGrayMaxGrayMaxGrayMaxGraymaxGray, t = ThresholdThresholdThresholdThresholdThresholdthreshold, and s is a factor that is computed from GammaGammaGammaGammaGammagamma, OffsetOffsetOffsetOffsetOffsetoffset, ThresholdThresholdThresholdThresholdThresholdthreshold, and MaxGrayMaxGrayMaxGrayMaxGrayMaxGraymaxGray 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 GammaGammaGammaGammaGammagamma = 1.0/2.4, OffsetOffsetOffsetOffsetOffsetoffset = 0.055, and ThresholdThresholdThresholdThresholdThresholdthreshold = 0.0031308. Similarly, the gamma encoding or decoding required by the HDTV video standard can be obtained by setting GammaGammaGammaGammaGammagamma = 0.45, OffsetOffsetOffsetOffsetOffsetoffset = 0.099, and ThresholdThresholdThresholdThresholdThresholdthreshold = 0.018. In any case, MaxGrayMaxGrayMaxGrayMaxGrayMaxGraymaxGray should be set as appropriate for the image type of ImageImageImageImageImageimage (e.g., 255.0 for byte images).

Attention

gamma_imagegamma_imageGammaImagegamma_imageGammaImageGammaImage 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.

Parallelization

Parameters

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

Input image.

GammaImageGammaImageGammaImageGammaImageGammaImagegammaImage (output_object)  (multichannel-)image(-array) objectHImageHImageHImageHImageXHobject * (byte / uint2 / real)

Output image.

GammaGammaGammaGammaGammagamma (input_control)  real HTupleHTupleHTupleVARIANTHtuple (real) (double) (double) (double) (double) (double)

Gamma coefficient of the exponential part of the transformation.

Default value: 0.416666666667

Suggested values: 0.416666666667, 0.45

OffsetOffsetOffsetOffsetOffsetoffset (input_control)  real HTupleHTupleHTupleVARIANTHtuple (real) (double) (double) (double) (double) (double)

Offset of the exponential part of the transformation.

Default value: 0.055

Suggested values: 0.055, 0.099

ThresholdThresholdThresholdThresholdThresholdthreshold (input_control)  real HTupleHTupleHTupleVARIANTHtuple (real) (double) (double) (double) (double) (double)

Gray value for which the transformation switches from linear to exponential.

Default value: 0.0031308

Suggested values: 0.0031308, 0.018

MaxGrayMaxGrayMaxGrayMaxGrayMaxGraymaxGray (input_control)  number HTupleHTupleHTupleVARIANTHtuple (real / integer) (double / int / long) (double / Hlong) (double / Hlong) (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

EncodeEncodeEncodeEncodeEncodeencode (input_control)  string HTupleHTupleHTupleVARIANTHtuple (string) (string) (HString) (char*) (BSTR) (char*)

If 'true'"true""true""true""true""true", perform a gamma encoding, otherwise a gamma decoding.

Default value: 'true' "true" "true" "true" "true" "true"

List of values: 'false'"false""false""false""false""false", 'true'"true""true""true""true""true"

Alternatives

pow_imagepow_imagePowImagepow_imagePowImagePowImage

See also

sqrt_imagesqrt_imageSqrtImagesqrt_imageSqrtImageSqrtImage, exp_imageexp_imageExpImageexp_imageExpImageExpImage, log_imagelog_imageLogImagelog_imageLogImageLogImage

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


ClassesClassesClassesClasses | | | | Operators