Gamma Correction Filter

Filter

RIF_IMAGE_FILTER_GAMMA_CORRECTION

Description

Gamma encoding of images is used to optimize the usage of bits when encoding an image, or bandwidth used to transport an image, by taking advantage of the non-linear manner in which humans perceive light and color. Can be defined as
Vout = Vin1/γ. Gamma correction should be used as the final stage of postprocessing for output to the low dynamic range (LDR) device or saving to an LDR image file.

Parameters

Parameter

Type

Input/Output

Description

gamma

float

input

The gamma value. A gamma value γ < 1 is sometimes called an encoding gamma, and the process of encoding with this compressive power-law nonlinearity is called gamma compression. Conversely, a gamma value γ > 1 is called a decoding gamma and the application of the expansive power-law nonlinearity is called gamma expansion.
Value range is [0, 5], default value is 1.

Usage Example

rif_image_filter filter = nullptr;
rifContextCreateImageFilter(context, RIF_IMAGE_FILTER_GAMMA_CORRECTION, &filter);
rifImageFilterSetParameter1f(filter, "gamma", 0.1f);
rifCommandQueueAttachImageFilter(queue, filter, inputImage, outputImage);
rifContextExecuteCommandQueue(context, queue, nullptr, nullptr, nullptr);